package com.tianqu.tms.dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.tianqu.LicensePlateConfigConstant;
import org.apache.commons.lang.StringUtils;

import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.core.util.DateUtil;
import com.tianqu.tms.core.util.StringUtil;
import com.tianqu.tms.dto.TransferAcceptedInfoDto;
import com.tianqu.tms.entity.TransferAcceptedInfo;

public class TransferAcceptedInfoDaoImp extends ViewListDao implements TransferAcceptedInfoDao {
	protected final String[] checkCarList = new String[] { "INTIME", "INTIME", "INTIME", "INTIME", "INTIME", "INTIME",
			"INTIME", "INTIME", "INTIME", "INTIME" };// 查验列表排序

	protected TransferAcceptedInfoDaoImp() throws TmsDaoException {
		super();
		// TODO Auto-generated constructor stub
	}

	protected TransferAcceptedInfoDaoImp(int pageNo, int maxIndex, int sortKey, boolean asc) throws TmsDaoException {
		super(pageNo, maxIndex, sortKey, asc);
	}

	/**
	 * 根据流水号查询受理信息
	 * 
	 */
	@Override
	public TransferAcceptedInfoDto getAssessInfoBySerial(String serial) throws TmsDaoException {
		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");

		sql.append("ID, ");
		sql.append("MARKETTYPE, ");
		sql.append("PG_PRICE,    ");
		sql.append("VIN,    ");
		sql.append("LICENSEPLATE,    ");
		sql.append("STATUS,    ");
		sql.append("AGENTNAME,    ");
		sql.append("AGENTOWNERIDCARDNO,    ");
		sql.append("AGENTADDRESS,    ");
		sql.append("MATERIALIMAGES2,    ");
		sql.append("MATERIALIMAGES1,    ");
		sql.append("MATERIALIMAGES3,    ");
		sql.append("MATERIALIMAGES4,    ");
		sql.append("MATERIALIMAGES5,    ");
		sql.append("OWNERSGROUPPHOTO,    ");
		sql.append("AGENTPHONE,    ");
		sql.append("AGENTTIME,     ");
		sql.append("LC_PRINTNUM,    ");
		sql.append("OWNERTYPE,    ");
		sql.append("BASICCARID,    ");
		sql.append("UPDATETIME,   ");
		sql.append("UPDATEUSERID,    ");
		sql.append("NEWOWNERTYPE,    ");
		sql.append("NEWCAROWNER,    ");
		sql.append("NEWCAROWNERIDCARDNO,    ");
		sql.append("NEWOWNERORGNO,    ");
		sql.append("NEWOWNERADDRESS ,   ");
		sql.append("NEWOWNERPHONE,   ");
		sql.append("NEWOWNERZIPCODE   , ");
		sql.append("NEWOWNERMAILADDRESS  ,  ");
		sql.append("NEWAGENTPHONE,    ");
		sql.append("NEWAGENTNAME   , ");
		sql.append("NEWAGENTOWNERIDCARDNO  ,  ");
		sql.append("NEWAGENTADDRESS ,   ");
		sql.append("GAINTYPE   , ");
		sql.append("CARMARKETIN   , ");
		sql.append("MOVEOUTPROVINCE  ,  ");
		sql.append("MOVEOUTCITY  ,  ");
		sql.append("TRANSFERTYPE   , ");
		sql.append("NEWOWNERTELPHONE  ,  ");
		sql.append("TRANSFERPRICE  ,  ");
		sql.append("PRICE  ,  ");
		sql.append("TAXNO  ,  ");
		sql.append("ATTNID,    ");
		sql.append("SOURCETYPE ,   ");
		sql.append("WAITFORSTATUS, ");
		sql.append("OWNERPHONE, ");
		// #104 start
		sql.append("brandId, ");
		// #104 e n d
		// #131 start
        sql.append("CHANGEUSENATURE,");
		// #131 e n d
		sql.append("PICCHANGENUM ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("   WHERE SERIAL ='" + serial + "' ");

		TransferAcceptedInfoDto dto = null;
		try {

			ps = conn.prepareStatement(sql.toString());

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setPg_price(rs.getInt("PG_PRICE"));
				dto.setVin(rs.getString("VIN"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setCarMarketIn(rs.getString("CARMARKETIN"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
				// #104 start
				dto.setBrandId(rs.getString("brandId"));
				// #104 e n d
				// #131 start
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				// #131 e n d
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	@Override
	public TransferAcceptedInfoDto findCarByLicense(String licensePlate) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("SERIAL ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("   WHERE LICENSEPLATE ='" + licensePlate + "' ");
		sql.append(" AND STATUS<>16");
		sql.append(" AND MARKETTYPE=2");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));

			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}

		return dto;
	}

	/**
	 * 
	 * 评估直接录入更新过户信息表
	 * 
	 * VIN 库存状态为2 评估价格 更新时间更新用户
	 */
	@Override
	public void updateAcceptInfoAtAssess(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" VIN=?,  			");
			sql.append(" MARKETTYPE=?,  	");
			sql.append(" PG_PRICE=?,  		");
			sql.append(" UPDATEUSERID=?,  	");
			sql.append(" UPDATETIME=SYSDATE(),	");
			sql.append(" PG_TIME=SYSDATE(),  	");
			sql.append(" STATUS=?,  		");
			sql.append(" PRICE=?,  			");
			sql.append(" PG_PRINTNUM=1,  	");//
			sql.append(" PG_PRINTTIME=SYSDATE(), ");
			sql.append(" PG_PRINTUSERID=?,  	");
			sql.append(" CAROWNER=?  	");
			sql.append(" WHERE SERIAL =?  	");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getVin());
			ps.setInt(2, dto.getMarketType());
			ps.setInt(3, dto.getPg_price());
			ps.setInt(4, dto.getUpdateUserId());
			ps.setInt(5, dto.getStatus());
			ps.setInt(6, dto.getPrice());
			ps.setInt(7, dto.getUpdateUserId());
			ps.setString(8, dto.getCarOwner());
			ps.setString(9, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public List<TransferAcceptedInfoDto> findCheckCarList(String vin, String licenseplate) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> carCheckList = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("T.SERIAL,");
		sql.append("T.LICENSEPLATE AS LICENSEPLATE,");
		sql.append("T.CY_CARDTYPE AS CY_CARDTYPE,");
		sql.append("T.PHOTO_1 AS PHOTO_1,");
		sql.append("T.VIN AS VIN,");
		sql.append("DATE_FORMAT(T.INSERTTIME,'%Y-%m-%d %k:%i') AS INSERTTIME,");
		sql.append("TIMESTAMPDIFF(DAY,T.INSERTTIME,SYSDATE()) AS INDS,");
		sql.append("T.CAROWNER AS CAROWNER,");
		sql.append("T.OWNERTYPE AS OWNERTYPE,");
		sql.append("T.LC_PRINTNUM AS LC_PRINTNUM,");
		sql.append("T.CY_PRINTNUM AS CY_PRINTNUM,");
		sql.append("T.SOURCETYPE AS SOURCETYPE,");
		sql.append("T.INSERTTIME AS INTIME, ");
		sql.append("S.CHECKPRICE, ");
		sql.append("S.CHECKPRICEDATE, ");
		sql.append("T.UPDATEUSERID AS UPDATEUSERID  ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" AS T ");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_TRANSFER_FINANCE_INFO + " S ON(T.SERIAL = S.SERIAL) ");
		sql.append(" WHERE ");
		sql.append(" T.STATUS <> 0 AND T.STATUS <> 16");// 20170318 modify by
														// huangwei
		if (StringUtil.isNotBlank(vin))
			sql.append(" and T.vin LIKE '%" + vin + "'");
		if (StringUtil.isNotBlank(licenseplate))
			sql.append(" and T.licensePlate LIKE '%" + licenseplate + "'");
		// 排序 INSERTTIME
		sql.append(getOrderBySql(checkCarList));
		try {
			ps = conn.prepareStatement(sql.toString());

			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setVin(rs.getString("VIN"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCheckPriceDate(rs.getTimestamp("CHECKPRICEDATE"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setInds(rs.getInt("INDS"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setCheckPrice(rs.getInt("CHECKPRICE"));
				carCheckList.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
		return carCheckList;

	}

	/**
	 * 查验车辆list
	 */
	@Override
	public List<TransferAcceptedInfoDto> findCheckCarList(int flag) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> carCheckList = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("T.SERIAL,");
		sql.append("T.LICENSEPLATE AS LICENSEPLATE,");
		sql.append("T.CY_CARDTYPE AS CY_CARDTYPE,");
		sql.append("T.PHOTO_1 AS PHOTO_1,");
		sql.append("T.VIN AS VIN,");
		sql.append("DATE_FORMAT(T.INSERTTIME,'%H:%i') AS INSERTTIME,");
		sql.append("TIMESTAMPDIFF(DAY,T.INSERTTIME,SYSDATE()) AS INDS,");
		sql.append("T.CAROWNER AS CAROWNER,");
		sql.append("T.OWNERTYPE AS OWNERTYPE,");
		sql.append("T.LC_PRINTNUM AS LC_PRINTNUM,");
		sql.append("T.CY_PRINTNUM AS CY_PRINTNUM,");
		sql.append("T.SOURCETYPE AS SOURCETYPE,");
		sql.append("T.INSERTTIME AS INTIME, ");
		sql.append("S.CHECKPRICE, ");
		sql.append("S.CHECKPRICEDATE, ");
		sql.append("P.USERNAME, ");
		sql.append("T.UPDATEUSERID AS UPDATEUSERID  ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" AS T ");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_TRANSFER_FINANCE_INFO + " S ON(T.SERIAL = S.SERIAL) ");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_PAD_HISTORY + " P ON(T.SERIAL = P.SERIAL) ");
		sql.append(" WHERE ");
		sql.append(" T.STATUS <> 0 AND T.STATUS <> 16");// 20170318 modify by
														// huangwei
		sql.append(" AND (T.CY_PRINTNUM <1 OR T.LC_PRINTNUM <1 OR T.LC_PRINTNUM IS NULL OR  T.CY_PRINTNUM is NULL) ");
		if (flag == 1) {
			sql.append(" AND  TO_DAYS(T.INSERTTIME) = TO_DAYS(NOW()) ");// 当天数据
		} else {
			sql.append(" AND  INSERTTIME<=DATE_SUB(CURDATE(), INTERVAL 1 MONTH) ");
		}
		// 排序 INSERTTIME
		sql.append(getOrderBySql(checkCarList));
		try {
			ps = conn.prepareStatement(sql.toString());

			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setVin(rs.getString("VIN"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCheckPriceDate(rs.getTimestamp("CHECKPRICEDATE"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setInds(rs.getInt("INDS"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setUserName(rs.getString("USERNAME"));
				dto.setCheckPrice(rs.getInt("CHECKPRICE"));
				carCheckList.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
		return carCheckList;
	}

	/**
	 * 待办受理部分更新过户表信息
	 * 
	 */
	@Override
	public void updateAcceptInfoAtProxy(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" VIN=?,  ");
			sql.append(" AGENTNAME=?,  ");
			sql.append(" AGENTPHONE=?,  ");
			sql.append(" AGENTOWNERIDCARDNO=?,  ");
			sql.append(" AGENTADDRESS=?,  ");
			sql.append(" MATERIALIMAGES1=?,  ");
			sql.append(" MATERIALIMAGES2=?,  ");
			sql.append(" MATERIALIMAGES3=?,  ");
			sql.append(" MATERIALIMAGES4=?,  ");
			sql.append(" MATERIALIMAGES5=?,  ");
			sql.append(" OWNERSGROUPPHOTO=?,  ");
			sql.append(" STATUS=?,  ");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" UPDATETIME=SYSDATE(),  ");
			sql.append(" AGENTTIME=SYSDATE(),  ");
			sql.append(" DB_PRINTNUM=?,  ");
			sql.append(" DB_PRINTTIME=SYSDATE(),  ");
			sql.append(" DB_PRINTUSERID=?,   ");
			sql.append(" PRETRANSFER=?,   ");
			sql.append(" TRANSFERPRICE=?,   ");
			sql.append(" TAXNO=?,   ");
			sql.append(" WAITFORSTATUS=?,   ");
			sql.append(" MEMBERID=?,   ");
			sql.append(" ATTACHMEMBERID=?,   ");
			sql.append(" OWNERTYPE=?,   ");
			sql.append(" OWNERORGNO=?,   ");
			sql.append(" CY_CARDTYPE=?,   ");
			sql.append(" CY_CARTYPE=?,   ");
			sql.append(" CAROWNER=?,   ");
			sql.append(" OWNERADDRESS=?,   ");
			sql.append(" OWNERPHONE=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getAgentName());
			ps.setString(3, dto.getAgentPhone());
			ps.setString(4, dto.getAgentOwnerIdCardNo());
			ps.setString(5, dto.getAgentAddress());
			ps.setString(6, dto.getMaterialImages1());
			ps.setString(7, dto.getMaterialImages2());
			ps.setString(8, dto.getMaterialImages3());
			ps.setString(9, dto.getMaterialImages4());
			ps.setString(10, dto.getMaterialImages5());
			ps.setString(11, dto.getOwnersGroupPhoto());
			ps.setInt(12, dto.getStatus());
			ps.setInt(13, dto.getUpdateUserId());
			ps.setInt(14, dto.getDb_printNum());
			ps.setInt(15, dto.getUpdateUserId());
			ps.setInt(16, dto.getPreTransfer());
			ps.setInt(17, dto.getTransferPrice());
			ps.setString(18, dto.getTaxNo());
			ps.setInt(19, dto.getWaitForStatus());
			ps.setString(20, dto.getMemberId());
			ps.setString(21, dto.getAttachMemberId());
			ps.setInt(22, dto.getOwnerType());
			ps.setString(23, dto.getOwnerOrgNo());
			ps.setInt(24, dto.getCardType());
			ps.setString(25, dto.getCarType());
			ps.setString(26, dto.getCarOwner());
			ps.setString(27, dto.getOwnerAddress());
			ps.setString(28, dto.getOwnerPhone());
			ps.setString(29, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}

	}

	/**
	 * 
	 * 根据VIN码查询上次评估价格和上次评估时间
	 */
	@Override
	public List<TransferAcceptedInfoDto> searchLastAssessInfoByVin(String vin) throws TmsDaoException {
		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> list = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" SERIAL, ");
		sql.append(" PG_PRICE, ");// 品牌ID
		sql.append(" PG_TIME  ");
		sql.append(" FROM  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE VIN='" + vin + "' ORDER BY PG_TIME DESC  ");

		TransferAcceptedInfoDto carDto = null;
		try {

			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				carDto = new TransferAcceptedInfoDto();
				carDto.setSerial(rs.getString("SERIAL"));
				carDto.setPg_price(rs.getInt("PG_PRICE"));
				carDto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
				list.add(carDto);
			}

			return list;

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * 根据车辆编号载入过户信息
	 */
	@Override
	public TransferAcceptedInfoDto getTransferByBasicCarId(String basicCarId) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("SERIAL, ");
		sql.append("MARKETTYPE,");
		sql.append("AGENTNAME, ");
		sql.append("AGENTOWNERIDCARDNO,    ");
		sql.append("AGENTADDRESS,    ");
		sql.append("AGENTPHONE,    ");
		sql.append("NEWOWNERTYPE,    ");
		sql.append("NEWCAROWNER,    ");
		sql.append("NEWCAROWNERIDCARDNO,    ");
		sql.append("NEWOWNERPHONE,    ");
		sql.append("NEWOWNERADDRESS,    ");
		sql.append("NEWOWNERORGNO,    ");
		sql.append("NEWAGENTNAME,    ");
		sql.append("NEWAGENTOWNERIDCARDNO,    ");
		sql.append("NEWAGENTADDRESS,     ");
		sql.append("NEWAGENTPHONE,   ");
		sql.append("NEWOWNERZIPCODE,");
		sql.append("NEWOWNERMAILADDRESS,");
		sql.append("PRICE,   ");
		sql.append("TRANSFERTYPE,   ");
		sql.append("CARMARKETIN,   ");
		sql.append("MOVEOUTPROVINCE,   ");
		sql.append("MOVEOUTCITY,   ");
		sql.append("TAXNO,   ");
		sql.append("GAINTYPE,   ");
		sql.append("TRANSFERPRICE ,");
		sql.append("EXTENDEDPRICE ,");
		sql.append("DOUBLETRANSFERPRICE,");
		sql.append("NEWOWNERTELPHONE,");
		sql.append("OWNERTYPE,");
		sql.append("STATUS, ");
		sql.append("LICENSEPLATE, ");
		sql.append("VIN ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("   WHERE BASICCARID =" + basicCarId);
		sql.append(" ORDER BY ID DESC");

		TransferAcceptedInfoDto dto = null;
		try {
			int i = 1;
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				if (i > 1) {
					break;
				}
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setCarMarketIn(rs.getString("CARMARKETIN"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				i++;
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;

	}

	
	
	
	/**
	 * 根据serial 更新过户信息 高级搜索中
	 * 
	 */
	@Override
	public void updateAcceptInfoBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" NEWAGENTADDRESS=?,  ");
			sql.append(" NEWAGENTNAME=?,  ");
			sql.append(" NEWAGENTOWNERIDCARDNO=?,  ");
			sql.append(" NEWAGENTPHONE=?,  ");
			sql.append(" NEWOWNERTYPE=?,  ");
			sql.append(" NEWCAROWNER=?,  ");
			sql.append(" NEWCAROWNERIDCARDNO=?,  ");
			sql.append(" NEWOWNERPHONE=?,  ");
			sql.append(" NEWOWNERADDRESS=?,  ");
			sql.append(" NEWOWNERORGNO=?,  ");
			sql.append(" NEWOWNERZIPCODE=?,  ");
			sql.append(" NEWOWNERMAILADDRESS=?,  ");
			sql.append(" PRICE=?,  ");
			sql.append(" CARMARKETIN=?,  ");
			sql.append(" TRANSFERTYPE=?,  ");
			sql.append(" MOVEOUTPROVINCE=?,  ");
			sql.append(" MOVEOUTCITY=?,  ");
			sql.append(" TAXNO=?,  ");
			sql.append(" GAINTYPE=?,  ");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" UPDATETIME=SYSDATE() , ");
			sql.append(" NEWOWNERTELPHONE=?  ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getNewAgentAddress());
			ps.setString(2, dto.getNewAgentName());
			ps.setString(3, dto.getNewAgentOwnerIdCardNo());
			ps.setString(4, dto.getNewAgentPhone());
			ps.setInt(5, dto.getNewOwnerType());
			ps.setString(6, dto.getNewcarOwner());
			ps.setString(7, dto.getNewcarOwnerIdCardNo());
			ps.setString(8, dto.getNewOwnerPhone());
			ps.setString(9, dto.getNewOwnerAddress());
			ps.setString(10, dto.getNewOwnerOrgNo());
			ps.setString(11, dto.getZipCode());
			ps.setString(12, dto.getMailAddress());
			ps.setInt(13, dto.getPrice());
			ps.setString(14, dto.getCarMarketIn());
			ps.setInt(15, dto.getTransferType());
			ps.setString(16, dto.getMoveOutProvince());
			ps.setString(17, dto.getMoveOutCity());
			ps.setString(18, dto.getTaxNo());
			ps.setInt(19, dto.getGainType());
			ps.setInt(20, dto.getUpdateUserId());
			ps.setString(21, dto.getNewOwnerTelPhone());
			ps.setString(22, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * PAD查验部分更新过户信息表
	 */
	@Override
	public void updateAcceptInfoAtPad(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" VIN=?,  ");
			sql.append(" LICENSEPLATE=?,  ");
			sql.append(" CY_CARDTYPE=?,  ");
			sql.append(" VINNUM=?,  ");
			sql.append(" ENGINENUM=?,  ");
			sql.append(" CY_COLOR=?,  ");
			sql.append(" CY_PASSENGER=?,  ");
			sql.append(" CY_CARTYPE=?,  ");
			sql.append(" PLATEORTIREEXTERIOR=?,  ");
			sql.append(" TIREINTACT=?,  ");
			sql.append(" SEATBELT=?,  ");
			sql.append(" NUMBERAXES=?,  ");
			sql.append(" TIRESIZE=?,  ");
			sql.append(" LATERALPORTIONOF=?,  ");
			sql.append(" REFLECTIVEMARK=?,  ");
			sql.append(" FIREEXTINGUISHER=?,  ");
			sql.append(" DRIVINGRECORD=?,  ");
			sql.append(" SECURITY=?,  ");
			sql.append(" EXTERNALMARKING=?,  ");
			sql.append(" SIREN=?,  ");
			sql.append(" SECURITYTECHNOLOGY=?,  ");
			sql.append(" CHECKCONCLUSION=?,  ");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" INSERTTIME=?,  ");
			sql.append(" UPDATETIME=SYSDATE(),  ");
			sql.append(" PHOTO_1=?,  ");
			sql.append(" PHOTO_2=?,  ");
			sql.append(" PHOTO_3=?,  ");
			sql.append(" PHOTO_4=?,  ");
			sql.append(" STATUS=?,  ");
			sql.append(" BRANDMODEL=?,  ");
			sql.append(" CARCLASS=?,  ");
			sql.append(" REGISTRATION=?,  ");
			sql.append(" TRANSFERREGISTER=?,  ");
			sql.append(" CHANGESVACATE=?,  ");
			sql.append(" TRANSFERPRICE=?,  ");
			sql.append(" PICCHANGENUM=?,");
			sql.append(" PICCHANGETIME=SYSDATE(),");
			sql.append(" PICCHANGEUSERID=? ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getLicensePlate());
			ps.setInt(3, dto.getCardType());
			ps.setString(4, dto.getVinNum());
			ps.setString(5, dto.getEngineNum());
			ps.setString(6, dto.getCy_color());
			ps.setString(7, dto.getCy_passenger());
			ps.setString(8, dto.getCarType());
			ps.setString(9, dto.getPlateOrTireExterior());
			ps.setString(10, dto.getTireIntact());
			ps.setString(11, dto.getSeatBelt());
			ps.setString(12, dto.getNumberAxes());
			ps.setString(13, dto.getTireSize());
			ps.setString(14, dto.getLateralPortionOf());
			ps.setString(15, dto.getReflectiveMark());
			ps.setString(16, dto.getFireExtinguisher());
			ps.setString(17, dto.getDrivingRecord());
			ps.setString(18, dto.getSecurity());
			ps.setString(19, dto.getExternalMarking());
			ps.setString(20, dto.getSiren());
			ps.setString(21, dto.getSecurityTechnology());
			ps.setString(22, dto.getCheckConclusion());
			ps.setInt(23, dto.getUpdateUserId());
			ps.setTimestamp(24, dto.getInsertTime());
			ps.setString(25, dto.getPhoto_1());
			ps.setString(26, dto.getPhoto_2());
			ps.setString(27, dto.getPhoto_3());
			ps.setString(28, dto.getPhoto_4());
			ps.setInt(29, dto.getStatus());
			ps.setString(30, dto.getBrandModel());
			ps.setInt(31, dto.getCarClass());
			ps.setInt(32, dto.getRegistration());
			ps.setInt(33, dto.getTransferRegister());
			ps.setInt(34, dto.getChangesVacate());
			ps.setInt(35, dto.getTransferPrice());
			ps.setInt(36, dto.getPicChangeNum());
			ps.setInt(37, dto.getPicChangeUserId());
			ps.setString(38, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * PAD向过户表中插入一条数据
	 */
	@Override
	public void insertCarInfoAtPad(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("INSERT INTO ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" (  ");
			sql.append(" VIN,  ");
			sql.append(" LICENSEPLATE,  ");
			sql.append(" CY_CARDTYPE,  ");
			sql.append(" VINNUM,  ");
			sql.append(" ENGINENUM,  ");
			sql.append(" CY_COLOR,  ");
			sql.append(" CY_PASSENGER,  ");
			sql.append(" CY_CARTYPE,  ");
			sql.append(" PLATEORTIREEXTERIOR,  ");
			sql.append(" TIREINTACT,  ");

			sql.append(" SEATBELT,  ");
			sql.append(" NUMBERAXES,  ");
			sql.append(" TIRESIZE,  ");
			sql.append(" LATERALPORTIONOF,  ");
			sql.append(" REFLECTIVEMARK,  ");
			sql.append(" FIREEXTINGUISHER,  ");
			sql.append(" DRIVINGRECORD,  ");
			sql.append(" SECURITY,  ");
			sql.append(" EXTERNALMARKING,  ");
			sql.append(" SIREN,  ");

			sql.append(" SECURITYTECHNOLOGY,  ");
			sql.append(" CHECKCONCLUSION,  ");
			sql.append(" INSERTUSERID,  ");
			sql.append(" INSERTTIME,  ");
			sql.append(" PHOTO_1,  ");
			sql.append(" PHOTO_2,  ");
			sql.append(" PHOTO_3,  ");
			sql.append(" PHOTO_4,  ");
			sql.append(" SERIAL,   ");
			sql.append(" MARKETTYPE,   ");
			sql.append(" STATUS,   ");

			sql.append(" BRANDMODEL,   ");
			sql.append(" OWNERTYPE,   ");
			sql.append(" CAROWNER,   ");
			sql.append(" CAROWNERIDCARDNO,   ");
			sql.append(" OWNERPHONE,   ");
			sql.append(" OWNERADDRESS,   ");
			sql.append(" OWNERORGNO,   ");
			sql.append(" TRANSFER,   ");
			sql.append(" CARCLASS,   ");
			sql.append(" BASICCARID,   ");

			sql.append(" UPDATETIME,  ");
			sql.append(" UPDATEUSERID,  ");

			sql.append(" REGISTRATION,  ");
			sql.append(" TRANSFERREGISTER,  ");
			sql.append(" CHANGESVACATE ");

			sql.append("  ) VALUES ( ");
			sql.append(" ?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?" + ",?,?,?,?,?,?,?,?," + "?,?,?,?,? ,?,?,?,? ,?,"
					+ "?,?,?,?,SYSDATE(),?,?,?,? )");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getLicensePlate());
			ps.setInt(3, dto.getCardType());
			ps.setString(4, dto.getVinNum());
			ps.setString(5, dto.getEngineNum());
			ps.setString(6, dto.getCy_color());
			ps.setString(7, dto.getCy_passenger());
			ps.setString(8, dto.getCarType());
			ps.setString(9, dto.getPlateOrTireExterior());
			ps.setString(10, dto.getTireIntact());

			ps.setString(11, dto.getSeatBelt());
			ps.setString(12, dto.getNumberAxes());
			ps.setString(13, dto.getTireSize());
			ps.setString(14, dto.getLateralPortionOf());
			ps.setString(15, dto.getReflectiveMark());
			ps.setString(16, dto.getFireExtinguisher());
			ps.setString(17, dto.getDrivingRecord());
			ps.setString(18, dto.getSecurity());
			ps.setString(19, dto.getExternalMarking());
			ps.setString(20, dto.getSiren());
			ps.setString(21, dto.getSecurityTechnology());
			ps.setString(22, dto.getCheckConclusion());
			ps.setInt(23, dto.getInsertUserid());
			ps.setTimestamp(24, dto.getInsertTime());
			ps.setString(25, dto.getPhoto_1());
			ps.setString(26, dto.getPhoto_2());
			ps.setString(27, dto.getPhoto_3());
			ps.setString(28, dto.getPhoto_4());
			ps.setString(29, dto.getSerial());
			ps.setInt(30, dto.getMarketType());
			ps.setInt(31, dto.getStatus());
			ps.setString(32, dto.getBrandModel());
			ps.setInt(33, dto.getOwnerType());
			ps.setString(34, dto.getCarOwner());
			ps.setString(35, dto.getCarOwnerIdCardNo());
			ps.setString(36, dto.getOwnerPhone());
			ps.setString(37, dto.getOwnerAddress());
			ps.setString(38, dto.getOwnerOrgNo());
			ps.setInt(39, dto.getTransfer());
			ps.setInt(40, dto.getCarClass());
			ps.setString(41, dto.getBasicCarId());
			ps.setInt(42, dto.getUpdateUserId());
			ps.setInt(43, dto.getRegistration());
			ps.setInt(44, dto.getTransferRegister());
			ps.setInt(45, dto.getChangesVacate());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}

	}

	/**
	 * 根据流水号或车牌号查询过户信息
	 */
	@Override
	public TransferAcceptedInfoDto searchAcceptInfoToPad(String serial, String licenseplate) throws TmsDaoException {

		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("SERIAL, ");
		sql.append("LICENSEPLATE, ");
		sql.append("VIN,    ");
		sql.append(" CY_CARDTYPE,  ");
		sql.append(" VINNUM,  ");
		sql.append(" ENGINENUM,  ");
		sql.append("BRANDMODEL,    ");
		sql.append(" CY_COLOR,  ");
		sql.append(" CY_PASSENGER,  ");
		sql.append(" CY_CARTYPE,  ");
		sql.append(" PLATEORTIREEXTERIOR,  ");
		sql.append(" TIREINTACT,  ");
		sql.append(" SEATBELT,  ");
		sql.append(" NUMBERAXES,  ");
		sql.append(" TIRESIZE,  ");
		sql.append(" LATERALPORTIONOF,  ");
		sql.append(" REFLECTIVEMARK,  ");
		sql.append(" FIREEXTINGUISHER,  ");
		sql.append(" DRIVINGRECORD,  ");
		sql.append(" SECURITY,  ");
		sql.append(" EXTERNALMARKING,  ");
		sql.append(" SIREN,  ");
		sql.append(" SECURITYTECHNOLOGY,  ");
		sql.append(" CHECKCONCLUSION,  ");
		sql.append(" PHOTO_1,  ");
		sql.append(" PHOTO_2,  ");
		sql.append(" PHOTO_3,  ");
		sql.append(" PHOTO_4,   ");
		sql.append(" INSERTTIME ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("  WHERE 1=1  ");

		if (serial != null && !"".equals(serial)) {
			sql.append(" AND SERIAL='" + serial + "'  ");
		}
		if (licenseplate != null && !"".equals(licenseplate)) {
			sql.append(" AND LICENSEPLATE='" + licenseplate + "'  ");
		}
		sql.append("ORDER BY ID DESC  ");

		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			int i = 1;
			while (rs.next()) {
				if (i == 2) {
					break;
				}
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setCarType(rs.getString("CY_CARTYPE"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
				i++;
			}
			return dto;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * 20160405 根据流水号查询打印次数（流程表和查验表）
	 */
	@Override
	public TransferAcceptedInfoDto findPrintNum(String serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();

		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("LC_PRINTNUM,");
			sql.append("CY_PRINTNUM,");
			sql.append("LICENSEPLATE,");
			sql.append("VIN,");
			sql.append("CAROWNER,");
			sql.append("TRANSFER,");
			sql.append("CHANGEUSENATURE,");
			sql.append("REPEATVIN,");
			sql.append("REPEATENGINENUM,");
			sql.append("CHANGEALLCAR,");
			sql.append("APPLYCERTIFICATE,");
			sql.append("REPLACEMENTCERTIFICATE,");
			sql.append("MONITORINGSALES,");
			sql.append("OTHER,");
			sql.append("VINNUM,");
			sql.append("ENGINENUM,");
			sql.append("BRANDMODEL,");
			sql.append("CY_COLOR,");
			sql.append("CY_PASSENGER,");
			sql.append("CY_CARTYPE,");
			sql.append("PLATEORTIREEXTERIOR,");
			sql.append("TIREINTACT,");
			sql.append("SEATBELT,");
			sql.append("NUMBERAXES,");
			sql.append("TIRESIZE,");
			sql.append("LATERALPORTIONOF,");
			sql.append("REFLECTIVEMARK,");
			sql.append("FIREEXTINGUISHER,");
			sql.append("DRIVINGRECORD,");
			sql.append("SECURITY,");
			sql.append("EXTERNALMARKING,");
			sql.append("SIREN,");
			sql.append("SECURITYTECHNOLOGY,");
			sql.append("CHECKCONCLUSION,");
			sql.append("PHOTO_1,");
			sql.append("PHOTO_2,");
			sql.append("PHOTO_3,");
			sql.append("PHOTO_4,");
			sql.append("REMARK,");
			sql.append("CY_CARDTYPE,");
			sql.append("BASICCARID, ");
			sql.append("MARKETTYPE, ");
			sql.append("PG_PRINTNUM, ");
			sql.append("DB_PRINTNUM, ");
			sql.append("ZY_PRINTNUM, ");
			sql.append("ZY_PRINTTIME, ");
			sql.append("ZY_PRINTUSERID, ");
			sql.append("GH_PRINTNUM, ");
			sql.append("GH_PRINTTIME, ");
			sql.append("GH_PRINTUSERID, ");
			sql.append("XS_PRINTNUM, ");
			sql.append("XS_PRINTUSERID, ");
			sql.append("XS_PRINTTIME, ");
			sql.append("REGISTRATION, ");
			sql.append("TRANSFERREGISTER, ");
			sql.append("CHANGESVACATE, ");
			sql.append("STATUS, ");
			sql.append("NEWLICENSEPLATE, ");
			sql.append("REAPPLYCERT, ");
			sql.append("ATTACHMEMBERID, ");
			sql.append("CARCLASS ");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, serial);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setCarType(rs.getString("CY_CARTYPE"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setReapplyCert(rs.getInt("REAPPLYCERT"));
				dto.setAttachMemberId(rs.getString("ATTACHMEMBERID"));
				dto.setCarClass(rs.getInt("CARCLASS"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	/**
	 * 根据流水号更新流程表打印次数
	 */
	@Override
	public void updateTransferLcPrintNum(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" LC_PRINTNUM=?,");
			sql.append(" CY_PRINTNUM=?,");
			sql.append(" LC_PRINTTIME=SYSDATE(),");
			sql.append(" CY_PRINTTIME=SYSDATE(),");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" CAROWNER=?,");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" OWNERTYPE=?,");
			sql.append(" STATUS=?,");
			sql.append(" LC_PRINTUSERID=?, ");
			sql.append(" SOURCETYPE=?, ");
			sql.append(" CY_CARDTYPE=?, ");
			sql.append(" TRANSFERPRICE=?, ");
			sql.append(" MEMBERID=?, ");
			sql.append(" ATTNID=?, ");
			sql.append(" licensePlate=?, ");
			sql.append(" VIN=?, ");
			sql.append(" licensePlateCol=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getLc_printNum());
			ps.setInt(2, dto.getCy_printNum());
			ps.setString(3, dto.getCarOwner());
			ps.setInt(4, dto.getUpdateUserId());
			ps.setInt(5, dto.getOwnerType());
			ps.setInt(6, dto.getStatus());
			ps.setInt(7, dto.getUpdateUserId());
			ps.setInt(8, dto.getSourceType());
			ps.setInt(9, dto.getCardType());
			ps.setInt(10, dto.getTransferPrice());
			ps.setString(11, dto.getMemberId());
			ps.setString(12, dto.getAttnId());
			ps.setString(13, dto.getLicensePlate());
			ps.setString(14, dto.getVin());
			ps.setString(15, dto.getLicensePlateCol());
			ps.setString(16, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public TransferAcceptedInfoDto getAcceptInfoBySerialAndCarLicense(String serial, String carLicense, int status)
			throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		TransferAcceptedInfoDto dto = null;
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("SERIAL,");
			sql.append("STATUS,");
			sql.append("LICENSEPLATE,");
			sql.append("VIN,");
			sql.append("CY_CARDTYPE,");
			sql.append("PHOTO_1,");
			sql.append("DATE_FORMAT(INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append("CAROWNER,");
			sql.append("LC_PRINTNUM,");
			sql.append("MARKETTYPE,");
			sql.append("OWNERTYPE,");
			sql.append("CY_PRINTNUM,");
			sql.append("LZ_PRINTNUM,");
			sql.append("LZ_PRINTTIME,");
			sql.append("LZ_PRINTUSERID,");
			sql.append("SOURCETYPE,");
			sql.append("PHOTO_1,  ");
			sql.append("BASICCARID,  ");
			sql.append("SOURCETYPE  ");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" WHERE 1=1 ");
			if (serial != null && !"".equals(serial)) {
				sql.append(" AND SERIAL='" + serial + "' ");
			}
			if (carLicense != null && !"".equals(carLicense)) {
				sql.append("AND LICENSEPLATE='" + carLicense + "' ");
			}
			if (status > 0) {
				sql.append(" AND STATUS = '" + status + "' ");
			}

			sql.append(" ORDER BY INSERTTIME DESC  ");

			ps = conn.prepareStatement(sql.toString());

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setVin(rs.getString("VIN"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
				dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
				dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	// 20160405
	@Override
	public void updateAcceptMemberIdBySerial(String serial, String memberId, String attnId) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" MEMBERID=?, ");
			sql.append(" ATTNID=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, memberId);
			ps.setString(2, attnId);
			ps.setString(3, serial);
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}

	}

	@Override
	public void updateAcceptStatusBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" STATUS=?,");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" CHANGETRADETICKET=?, ");
			sql.append(" WAITFORSTATUS=?, ");
			sql.append(" CHECKUSERID=?, ");
			sql.append(" CHECKFILESTATUS=?, ");
			sql.append(" TRANSFERPRICE=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getStatus());
			ps.setInt(2, dto.getUpdateUserId());
			ps.setInt(3, dto.getChangeTradeTicket());
			ps.setInt(4, dto.getWaitForStatus());
			ps.setInt(5, dto.getCheckUserid());
			ps.setInt(6, dto.getCheckFileStatus());
			ps.setInt(7, dto.getTransferPrice());
			ps.setString(8, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}

	}

	/**
	 * 打印查验表
	 */
	@Override
	public void updateTransferCyPrintNumBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" CY_PRINTNUM=?,");
			sql.append(" CY_PRINTTIME=SYSDATE(),");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" CY_PRINTUSERID=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getCy_printNum());
			ps.setInt(2, dto.getUpdateUserId());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setString(4, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateMarketCyPrintNum(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" CY_PRINTNUM=?,");
			sql.append(" CY_PRINTTIME=SYSDATE(),");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" CY_PRINTUSERID=?, ");
			sql.append(" CAROWNER=?,");
			sql.append("CY_CARDTYPE=?");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getCy_printNum());
			ps.setInt(2, dto.getUpdateUserId());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setString(4, dto.getCarOwner());
			ps.setInt(5, dto.getCardType());
			ps.setString(6, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * 根据流水号查询过户状态
	 */
	@Override
	public TransferAcceptedInfoDto findTransStatusBySerial(String serial) throws TmsDaoException {
		// TODO Auto-generated method stub
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("STATUS, ");
		sql.append(" OWNERTYPE, ");
		sql.append(" TRANSNO, ");
		sql.append(" TRANSMARKET, ");
		sql.append(" GH_PRINTTIME, ");
		sql.append(" MARKETTYPE, ");
		sql.append(" VIN, ");
		sql.append(" TRANSFERPRICE, ");
		sql.append(" EXTENDEDPRICE, ");
		sql.append(" DOUBLETRANSFERPRICE, ");
		sql.append(" BASICCARID, ");
		sql.append(" MATERIALIMAGES1,  ");
		sql.append(" MATERIALIMAGES2,  ");
		sql.append(" MATERIALIMAGES3,  ");
		sql.append(" MATERIALIMAGES4,  ");
		sql.append(" MATERIALIMAGES5,  ");
		sql.append(" OWNERSGROUPPHOTO  ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("  WHERE SERIAL=?  ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, serial);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setStatus(rs.getInt("STATUS"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setVin(rs.getString("VIN"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
			}
			return dto;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}

	}

	@Override
	public void insertEasyCar(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("INSERT INTO ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" (  ");
		sql.append(" VIN,  ");
		sql.append(" LICENSEPLATE,  ");
		sql.append(" SERIAL,  ");
		sql.append(" MARKETTYPE,  ");
		sql.append(" BASICCARID,  ");
		sql.append("  SOURCETYPE,  ");
		sql.append(" STATUS,  ");
		sql.append(" INSERTUSERID,  ");
		sql.append(" UPDATEUSERID,  ");
		sql.append(" INSERTTIME,  ");
		sql.append(" UPDATETIME, ");
		sql.append(" CARCLASS, ");
		sql.append(" CAROWNER, ");
		sql.append(" CAROWNERIDCARDNO, ");
		sql.append(" OWNERPHONE, ");
		sql.append(" OWNERADDRESS, ");
		sql.append(" OWNERORGNO, ");
		sql.append(" OWNERTYPE, ");
		sql.append(" CY_CARDTYPE,");
		sql.append(" PHOTO_1,");
		sql.append(" PHOTO_2,");
		sql.append(" PHOTO_3,");
		sql.append(" PHOTO_4,");
		sql.append(" VINNUM,");
		sql.append(" ENGINENUM,");
		sql.append(" BRANDMODEL,");
		sql.append(" PLATEORTIREEXTERIOR,");
		sql.append(" TIREINTACT,");
		sql.append(" SEATBELT,");
		sql.append(" ATTNID,");
		sql.append(" MEMBERID,");// modify by huangheli
		sql.append(" WAITFORSTATUS");// modify by huangwei
		sql.append("  ) VALUES ( ");
		sql.append("?,?,?,?,?,?,?,?,?,SYSDATE(),SYSDATE(),?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");

		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getLicensePlate());
			ps.setString(3, dto.getSerial());
			ps.setInt(4, dto.getMarketType());
			ps.setString(5, dto.getBasicCarId());
			ps.setInt(6, dto.getSourceType());
			ps.setInt(7, dto.getStatus());
			ps.setInt(8, dto.getInsertUserid());
			ps.setInt(9, dto.getUpdateUserId());
			ps.setInt(10, dto.getCarClass());
			ps.setString(11, dto.getCarOwner());
			ps.setString(12, dto.getCarOwnerIdCardNo());
			ps.setString(13, dto.getOwnerPhone());
			ps.setString(14, dto.getOwnerAddress());
			ps.setString(15, dto.getOwnerOrgNo());
			ps.setInt(16, dto.getOwnerType());
			ps.setInt(17, dto.getCardType());
			ps.setString(18, dto.getPhoto_1());
			ps.setString(19, dto.getPhoto_2());
			ps.setString(20, dto.getPhoto_3());
			ps.setString(21, dto.getPhoto_4());
			ps.setString(22, dto.getVinNum());
			ps.setString(23, dto.getEngineNum());
			ps.setString(24, dto.getBrandModel());
			ps.setString(25, dto.getPlateOrTireExterior());
			ps.setString(26, dto.getTireIntact());
			ps.setString(27, dto.getSeatBelt());
			ps.setString(28, dto.getAttnId());
			ps.setString(29, dto.getMemberId());// modify by huangheli
			ps.setInt(30, dto.getWaitForStatus());// modify by huangwei
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void insertCarWithWeiChat(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("INSERT INTO ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" (  ");
		sql.append(" LICENSEPLATE,  ");
		sql.append(" SERIAL,  ");
		sql.append(" MARKETTYPE,  ");
		sql.append(" BASICCARID,  ");
		sql.append(" SOURCETYPE,  ");
		sql.append(" STATUS,  ");
		sql.append(" CARCLASS, ");
		sql.append(" MEMBERID, ");
		sql.append(" ATTNID, ");
		sql.append(" CY_CARDTYPE, ");
		sql.append(" PHOTO_1, ");
		sql.append(" INSERTUSERID,  ");
		sql.append(" UPDATEUSERID,  ");
		sql.append(" INSERTTIME,  ");
		sql.append(" UPDATETIME ");
		sql.append("  ) VALUES ( ");
		sql.append("?,?,?,?,?,?,?,?,?,?,?,?,?,SYSDATE(),SYSDATE())");

		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getLicensePlate());
			ps.setString(2, dto.getSerial());
			ps.setInt(3, dto.getMarketType());
			ps.setString(4, dto.getBasicCarId());
			ps.setInt(5, dto.getSourceType());
			ps.setInt(6, dto.getStatus());
			ps.setInt(7, dto.getCarClass());
			ps.setString(8, dto.getMemberId());
			ps.setString(9, dto.getAttnId());
			ps.setString(10, dto.getCarType());
			ps.setString(11, dto.getPhoto_1());
			ps.setInt(12, dto.getInsertUserid());
			ps.setInt(13, dto.getUpdateUserId());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void insertCarResumeInfo(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("INSERT INTO ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" (  ");
		sql.append(" LICENSEPLATE,  ");
		sql.append(" SERIAL,  ");
		sql.append(" MARKETTYPE,  ");
		sql.append(" BASICCARID,  ");
		sql.append(" SOURCETYPE,  ");
		sql.append(" STATUS,  ");
		sql.append(" CARCLASS, ");
		sql.append(" MEMBERID, ");
		sql.append(" INSERTUSERID,  ");
		sql.append(" UPDATEUSERID,  ");
		sql.append(" INSERTTIME,  ");
		sql.append(" UPDATETIME ");
		sql.append("  ) VALUES ( ");
		sql.append("?,?,?,?,?,?,?,?,?,?,SYSDATE(),SYSDATE())");

		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getLicensePlate());
			ps.setString(2, dto.getSerial());
			ps.setInt(3, dto.getMarketType());
			ps.setString(4, dto.getBasicCarId());
			ps.setInt(5, dto.getSourceType());
			ps.setInt(6, dto.getStatus());
			ps.setInt(7, dto.getCarClass());
			ps.setString(8, dto.getMemberId());
			ps.setInt(9, dto.getInsertUserid());
			ps.setInt(10, dto.getUpdateUserId());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateMarketTypeBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" MARKETTYPE=?,");
			sql.append(" BASICCARID=?,");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" UPDATEUSERID=?, ");
			sql.append(" LICENSEPLATE=?, ");
			sql.append(" CAROWNER=?, ");
			sql.append(" CAROWNERIDCARDNO=?, ");
			sql.append(" OWNERADDRESS=?, ");
			sql.append(" OWNERORGNO=?, ");
			sql.append(" OWNERPHONE=?, ");
			sql.append(" OWNERTYPE=?, ");
			sql.append(" PRICE=?, ");
			sql.append(" VIN=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getMarketType());
			ps.setString(2, dto.getBasicCarId());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setString(4, dto.getLicensePlate());
			ps.setString(5, dto.getCarOwner());
			ps.setString(6, dto.getCarOwnerIdCardNo());
			ps.setString(7, dto.getOwnerAddress());
			ps.setString(8, dto.getOwnerOrgNo());
			ps.setString(9, dto.getOwnerPhone());
			ps.setInt(10, dto.getOwnerType());
			ps.setInt(11, dto.getPrice());
			ps.setString(12, dto.getVin());
			ps.setString(13, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}
	
	public void updateTransBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" VIN=?,");
			sql.append(" VENDORCODE=?,  ");
			sql.append(" UPDATETIME=SYSDATE(), ");
			sql.append(" MODELCODE=?,");
			sql.append(" CY_CARDTYPE=?,");
			sql.append(" COUNTRYSTYLE=?,");
			sql.append(" CARUSE=?, ");
			sql.append(" CY_CARDTYPE=?, ");
			sql.append(" REGISTERCARDNO=?, ");
			sql.append(" REGDATE=?, ");
			sql.append(" ATTACHMEMBERID=?, ");
			sql.append(" OWNERTYPE=?, ");
			sql.append(" CAROWNERIDCARDNO=?, ");
			sql.append(" CAROWNER=?, ");
			sql.append(" OWNERPHONE=?, ");
			sql.append(" OWNERADDRESS=?, ");
			sql.append(" AGENTOWNERIDCARDNO=?, ");
			sql.append(" AGENTNAME=?, ");
			sql.append(" AGENTPHONE=?, ");
			sql.append(" AGENTADDRESS=?, ");
			sql.append(" MATERIALIMAGES1=?, ");
			sql.append(" MATERIALIMAGES2=?, ");
			sql.append(" MATERIALIMAGES3=?, ");
			sql.append(" MATERIALIMAGES4=?, ");
			sql.append(" MATERIALIMAGES5=?, ");
			sql.append(" MATERIALIMAGES6=?, ");
			sql.append(" MATERIALIMAGES7=?, ");
			sql.append(" MATERIALIMAGES8=?, ");
			sql.append(" MATERIALIMAGES9=?, ");
			sql.append(" MATERIALIMAGES10=?, ");
			sql.append(" WAITFORSTATUS=13, ");
			sql.append(" DB_PRINTNUM=1, ");
			sql.append(" DB_PRINTTIME=SYSDATE(), ");
			sql.append(" AGENTTIME=SYSDATE(), ");
			sql.append(" INSERTTIME=SYSDATE(), ");
			sql.append(" UPDATETIME=SYSDATE(), ");
			sql.append(" INSERTUSERID=?, ");
			sql.append(" UPDATEUSERID=?, ");
			sql.append(" MEMBERID=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getVendorCode());
			ps.setString(3, dto.getModelCode());
			ps.setInt(4, dto.getCardType());
			ps.setString(5, dto.getCountryStyle());
			ps.setString(6, dto.getCarUse());
			ps.setString(7, dto.getCy_carType());
			ps.setString(8, dto.getRegisterCardNo());
			if(StringUtil.isNotBlank(dto.getRegDateStr())) ps.setString(9, dto.getRegDateStr());
			else  ps.setString(9,null);
			ps.setString(10, dto.getAttachMemberId());
			ps.setInt(11, dto.getOwnerType());
			ps.setString(12, dto.getCarOwnerIdCardNo());
			ps.setString(13, dto.getCarOwner());
			ps.setString(14, dto.getOwnerPhone());
			ps.setString(15, dto.getOwnerAddress());
			ps.setString(16, dto.getAgentOwnerIdCardNo());
			ps.setString(17, dto.getAgentName());
			ps.setString(18, dto.getAgentPhone());
			ps.setString(19, dto.getAgentAddress());
			ps.setString(20, dto.getMaterialImages1());
			ps.setString(21, dto.getMaterialImages2());
			ps.setString(22, dto.getMaterialImages3());
			ps.setString(23, dto.getMaterialImages4());
			ps.setString(24, dto.getMaterialImages5());
			ps.setString(25, dto.getMaterialImages6());
			ps.setString(26, dto.getMaterialImages7());
			ps.setString(27, dto.getMaterialImages8());
			ps.setString(28, dto.getMaterialImages9());
			ps.setString(29, dto.getMaterialImages10());
			ps.setInt(30, dto.getInsertUserid());
			ps.setInt(31, dto.getUpdateUserId());
			ps.setString(32, dto.getMemberId());
			ps.setString(33, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateTransStatusBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" STATUS=?,");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" UPDATETIME=SYSDATE(), ");
			sql.append(" LC_PRINTTIME=SYSDATE(),");
			sql.append(" CY_PRINTTIME=SYSDATE(),");
			sql.append("LC_PRINTNUM=?,");
			sql.append("LC_PRINTUSERID=?,");
			sql.append("TRANSFERPRICE=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getStatus());
			ps.setInt(2, dto.getUpdateUserId());
			ps.setInt(3, dto.getLc_printNum());
			ps.setInt(4, dto.getLc_printUserId());
			ps.setInt(5, dto.getTransferPrice());
			ps.setString(6, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptInfoAtGh(TransferAcceptedInfoDto dto, boolean updateMatch) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" VIN=?,  ");
			sql.append(" AGENTNAME=?,  ");
			sql.append(" AGENTPHONE=?,  ");
			sql.append(" AGENTOWNERIDCARDNO=?,  ");
			sql.append(" AGENTADDRESS=?,  ");

			sql.append(" MATERIALIMAGES1=?,  ");
			sql.append(" MATERIALIMAGES2=?,  ");
			sql.append(" MATERIALIMAGES3=?,  ");
			sql.append(" MATERIALIMAGES4=?,  ");
			sql.append(" MATERIALIMAGES5=?,  ");

			sql.append(" OWNERSGROUPPHOTO=?,  ");
			sql.append(" STATUS=?,  ");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" UPDATETIME=SYSDATE(),  ");
			sql.append(" NEWOWNERTYPE=?,   ");
			sql.append(" NEWCAROWNER=?,   ");

			sql.append(" NEWCAROWNERIDCARDNO=?,   ");
			sql.append(" NEWOWNERORGNO=?,   ");
			sql.append(" NEWOWNERADDRESS=?,   ");
			sql.append(" NEWOWNERPHONE=?,   ");
			sql.append("NEWOWNERZIPCODE=?   , ");

			sql.append("NEWOWNERMAILADDRESS=?  ,  ");
			sql.append(" NEWAGENTPHONE=?,   ");
			sql.append(" NEWAGENTNAME=?,   ");
			sql.append(" NEWAGENTOWNERIDCARDNO=?,   ");
			sql.append(" NEWAGENTADDRESS=?,   ");

			sql.append(" GAINTYPE=?,   ");
			sql.append(" CARMARKETIN=?,   ");
			sql.append(" MOVEOUTPROVINCE=?,   ");

			sql.append(" MOVEOUTCITY=?,   ");
			sql.append(" TRANSFERTYPE=?,   ");
			sql.append(" NEWOWNERTELPHONE=?,   ");
			sql.append(" TRANSFERPRICE=?,   ");
			sql.append(" PRICE=?,   ");

			sql.append(" TAXNO=?,   ");
			sql.append(" ATTNID=?,   ");
			sql.append(" REMARK=?,   ");
			sql.append(" ZY_PRINTNUM=?,   ");
			sql.append(" ZY_PRINTUSERID=?,   ");
			sql.append(" ZY_PRINTTIME=?,   ");

			sql.append(" OWNERTYPE=?,   ");
			sql.append(" CAROWNERIDCARDNO=?,   ");
			sql.append(" OWNERPHONE=?,   ");
			sql.append(" OWNERADDRESS=?,   ");
			sql.append(" CAROWNER=?,   ");
			sql.append(" PRETRANSFER=?,   ");
			sql.append(" WAITFORSTATUS=?,   ");
			sql.append(" MEMBERID=?,   ");
			sql.append(" CHECKFILESTATUS=?,   ");
			sql.append(" SOURCETYPE=?,   ");
			sql.append(" OWNERORGNO=?   ");
			// #104 start
			if (updateMatch) {
				sql.append(", vendorId=?,   ");
				sql.append(" brandId=?,   ");
				sql.append(" carStyleId=?,   ");
				sql.append(" carName=?,   ");
				sql.append(" isMatch=?   ");
			}
			// #104 e n d

			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getAgentName());
			ps.setString(3, dto.getAgentPhone());
			ps.setString(4, dto.getAgentOwnerIdCardNo());
			ps.setString(5, dto.getAgentAddress());
			ps.setString(6, dto.getMaterialImages1());
			ps.setString(7, dto.getMaterialImages2());
			ps.setString(8, dto.getMaterialImages3());
			ps.setString(9, dto.getMaterialImages4());
			ps.setString(10, dto.getMaterialImages5());
			ps.setString(11, dto.getOwnersGroupPhoto());
			ps.setInt(12, dto.getStatus());
			ps.setInt(13, dto.getUpdateUserId());
			ps.setInt(14, dto.getNewOwnerType());
			ps.setString(15, dto.getNewcarOwner());
			ps.setString(16, dto.getNewcarOwnerIdCardNo());
			ps.setString(17, dto.getNewOwnerOrgNo());
			ps.setString(18, dto.getNewOwnerAddress());
			ps.setString(19, dto.getNewOwnerPhone());
			ps.setString(20, dto.getZipCode());
			ps.setString(21, dto.getMailAddress());
			ps.setString(22, dto.getNewAgentPhone());
			ps.setString(23, dto.getNewAgentName());
			ps.setString(24, dto.getNewAgentOwnerIdCardNo());
			ps.setString(25, dto.getNewAgentAddress());
			ps.setInt(26, dto.getGainType());
			ps.setString(27, dto.getCarMarketIn());
			ps.setString(28, dto.getMoveOutProvince());
			ps.setString(29, dto.getMoveOutCity());
			ps.setInt(30, dto.getTransferType());
			ps.setString(31, dto.getNewOwnerTelPhone());
			ps.setInt(32, dto.getTransferPrice());
			ps.setInt(33, dto.getPrice());
			ps.setString(34, dto.getTaxNo());
			ps.setString(35, dto.getAttnId());
			ps.setString(36, dto.getRemark());

			ps.setInt(37, dto.getZy_printnum());
			ps.setInt(38, dto.getZy_printUserId());
			ps.setTimestamp(39, dto.getZy_printTime());

			ps.setInt(40, dto.getOwnerType());
			ps.setString(41, dto.getCarOwnerIdCardNo());
			ps.setString(42, dto.getOwnerPhone());
			ps.setString(43, dto.getOwnerAddress());
			ps.setString(44, dto.getCarOwner());

			ps.setInt(45, dto.getPreTransfer());
			ps.setInt(46, dto.getWaitForStatus());
			ps.setString(47, dto.getMemberId());// add by huangheli
			ps.setInt(48, dto.getCheckFileStatus());// add by huangheli
			ps.setInt(49, dto.getSourceType());
			ps.setString(50, dto.getOwnerOrgNo());
			// #104 start
			if (updateMatch) {
				ps.setString(51, dto.getVendorId());
				ps.setString(52, dto.getBrandId());
				ps.setString(53, dto.getCarStyleId());
				ps.setString(54, dto.getCarName());
				ps.setInt(55, dto.getIsMatch());
				ps.setString(56, dto.getSerial());
			} else {
				ps.setString(51, dto.getSerial());
			}
			// #104 e n d
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}

	}

	@Override
	public void updateAcceptInfoAtJYP(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" NEWOWNERTYPE=?,   ");
			sql.append(" NEWCAROWNER=?,   ");
			sql.append(" NEWCAROWNERIDCARDNO=?,   ");
			sql.append(" NEWOWNERORGNO=?,   ");
			sql.append(" NEWOWNERADDRESS=?,   ");

			sql.append(" NEWOWNERPHONE=?,   ");
			sql.append(" CARMARKETIN=?,   ");
			sql.append(" NEWOWNERTELPHONE=?,   ");
			sql.append(" PRICE=?,   ");
			sql.append(" REMARK=?,   ");

			sql.append(" TAXNO=?,   ");
			sql.append(" TRANSNO=?,   ");
			sql.append(" TRANSMARKET=?,   ");
			sql.append(" STATUS=?,   ");
			sql.append(" GH_PRINTNUM=?,   ");

			sql.append(" GH_PRINTUSERID=?,   ");
			sql.append(" GH_PRINTTIME=SYSDATE(),   ");
			sql.append(" OWNERTYPE=?,   ");
			sql.append(" CAROWNERIDCARDNO=?,   ");
			sql.append(" OWNERORGNO=?,   ");
			sql.append(" OWNERPHONE=?,   ");

			sql.append(" OWNERADDRESS=?,   ");
			sql.append(" CAROWNER=?,   ");
			sql.append(" CHANGETRADETICKET=?,   ");

			sql.append(" NEWAGENTNAME=?,   ");
			sql.append(" NEWAGENTOWNERIDCARDNO=?,   ");
			sql.append(" NEWAGENTADDRESS=?,   ");
			sql.append(" NEWAGENTPHONE=? ,   ");
			sql.append(" OWNERTYPE=?,");
			sql.append("NEWOWNERTYPE=?,");
			sql.append("MOVEOUTPROVINCE=?,");
			sql.append("MOVEOUTCITY=?,");
			sql.append("TRANSFERTYPE=?");

			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getNewOwnerType());
			ps.setString(2, dto.getNewcarOwner());
			ps.setString(3, dto.getNewcarOwnerIdCardNo());
			ps.setString(4, dto.getNewOwnerOrgNo());
			ps.setString(5, dto.getNewOwnerAddress());

			ps.setString(6, dto.getNewOwnerPhone());
			ps.setString(7, dto.getCarMarketIn());
			ps.setString(8, dto.getNewOwnerTelPhone());
			ps.setInt(9, dto.getPrice());
			ps.setString(10, dto.getRemark());

			ps.setString(11, dto.getTaxNo());
			ps.setString(12, dto.getTransNo());
			ps.setString(13, dto.getTransMarket());
			ps.setInt(14, dto.getStatus());
			ps.setInt(15, dto.getGh_printnum());

			ps.setInt(16, dto.getGh_printUserId());
			ps.setInt(17, dto.getOwnerType());
			ps.setString(18, dto.getCarOwnerIdCardNo());
			ps.setString(19, dto.getOwnerOrgNo());
			ps.setString(20, dto.getOwnerPhone());
			ps.setString(21, dto.getOwnerAddress());
			ps.setString(22, dto.getCarOwner());
			ps.setInt(23, dto.getChangeTradeTicket());

			ps.setString(24, dto.getNewAgentName());
			ps.setString(25, dto.getNewAgentOwnerIdCardNo());
			ps.setString(26, dto.getNewAgentAddress());
			ps.setString(27, dto.getNewAgentPhone());

			ps.setInt(28, dto.getOwnerType());
			ps.setInt(29, dto.getNewOwnerType());
			ps.setString(30, dto.getMoveOutProvince());
			ps.setString(31, dto.getMoveOutCity());
			ps.setInt(32, dto.getTransferType());
			ps.setString(33, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateTransferLzPrintNum(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" Lz_PRINTNUM=?,");
			sql.append(" Lz_PRINTTIME=SYSDATE(),");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" LZ_PRINTUSERID=?,");
			sql.append(" UPDATEUSERID=?       ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getLz_printnum());
			ps.setInt(2, dto.getLz_printUserId());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setString(4, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateTransferXsPrintNum(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" XS_PRINTNUM=?,");
			sql.append(" XS_PRINTTIME=SYSDATE(),");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" XS_PRINTUSERID=?,");
			sql.append(" LICENSEACCEPTIME=SYSDATE(),");
			sql.append(" UPDATEUSERID=?,       ");
			sql.append(" STATUS=?,       ");
			sql.append(" NEWLICENSEPLATE=?,       ");
			sql.append(" REAPPLYCERT=?       ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getXs_printnum());
			ps.setInt(2, dto.getXs_printUserId());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setInt(4, dto.getStatus());
			ps.setString(5, dto.getNewLicensePlate());
			ps.setInt(6, dto.getReapplyCert());
			ps.setString(7, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptInfoMarketBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" CAROWNER=?,");
			sql.append(" CAROWNERIDCARDNO=?,");
			sql.append(" OWNERADDRESS=?, ");
			sql.append(" OWNERORGNO=?, ");
			sql.append(" OWNERPHONE=?,");
			sql.append(" OWNERTYPE=?,");
			sql.append(" CY_CARDTYPE=?");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getUpdateUserId());
			ps.setString(2, dto.getCarOwner());
			ps.setString(3, dto.getCarOwnerIdCardNo());
			ps.setString(4, dto.getOwnerAddress());
			ps.setString(5, dto.getOwnerOrgNo());
			ps.setString(6, dto.getOwnerPhone());
			ps.setInt(7, dto.getOwnerType());
			ps.setInt(8, dto.getCardType());
			ps.setString(9, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptInfoByWeiChart(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" UPDATETIME=SYSDATE(),");
			sql.append(" STATUS=?,");
			sql.append(" PHOTO_1=?, ");
			sql.append(" ATTNID=?, ");
			sql.append(" CY_CARDTYPE=?");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getUpdateUserId());
			ps.setInt(2, dto.getStatus());
			ps.setString(3, dto.getPhoto_1());
			ps.setString(4, dto.getAttnId());
			ps.setInt(5, dto.getCardType());
			ps.setString(6, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}
	 
	@Override
	public void updatePic(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" MATERIALIMAGES1=?,  ");
			sql.append(" MATERIALIMAGES2=?,  ");
			sql.append(" MATERIALIMAGES3=?,  ");
			sql.append(" MATERIALIMAGES4=?,  ");
			sql.append(" MATERIALIMAGES5=?,  ");
			sql.append(" OWNERSGROUPPHOTO=?   ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getMaterialImages1());
			ps.setString(2, dto.getMaterialImages2());
			ps.setString(3, dto.getMaterialImages3());
			ps.setString(4, dto.getMaterialImages4());
			ps.setString(5, dto.getMaterialImages5());
			ps.setString(6, dto.getOwnersGroupPhoto());
			ps.setString(7, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void insertCarInfoAtChx(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("INSERT INTO ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" (  ");
			sql.append(" SERIAL,  ");
			sql.append(" MARKETTYPE,  ");
			sql.append(" LICENSEPLATE,  ");
			sql.append(" STATUS,  ");
			sql.append(" LC_PRINTNUM,  ");

			sql.append(" LC_PRINTUSERID,  ");
			sql.append(" CARCLASS,  ");
			sql.append(" SOURCETYPE,  ");
			sql.append(" CY_CARDTYPE,  ");
			sql.append(" CAROWNER,  ");

			sql.append(" OWNERTYPE,  ");
			sql.append(" LC_PRINTTIME,  ");
			sql.append(" UPDATETIME,  ");
			sql.append(" UPDATEUSERID,  ");

			sql.append(" INSERTUSERID,  ");
			sql.append(" INSERTTIME,  ");
			sql.append(" VIN,  ");
			sql.append(" BASICCARID,  ");
			sql.append(" TRANSFERPRICE  ");

			sql.append("  ) VALUES ( ");
			sql.append(" ?,?,?,?,?,?,?,?,?,?,?,SYSDATE(),SYSDATE(),?,?,SYSDATE(),?,?,? )");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getSerial());
			ps.setInt(2, dto.getMarketType());
			ps.setString(3, dto.getLicensePlate());
			ps.setInt(4, dto.getStatus());
			ps.setInt(5, dto.getLc_printNum());

			ps.setInt(6, dto.getLc_printUserId());
			ps.setInt(7, dto.getCarClass());
			ps.setInt(8, dto.getSourceType());
			ps.setInt(9, dto.getCardType());
			ps.setString(10, dto.getCarOwner());

			ps.setInt(11, dto.getOwnerType());
			ps.setInt(12, dto.getLc_printUserId());
			ps.setInt(13, dto.getLc_printUserId());
			ps.setString(14, dto.getVin());
			ps.setString(15, dto.getBasicCarId());
			ps.setInt(16, dto.getTransferPrice());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}

	}

	@Override
	public TransferAcceptedInfoDto getAssessInfoByLicenseplate(String licenseplate) throws TmsDaoException {
		// TODO Auto-generated method stub
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("STATUS, ");
		sql.append(" OWNERTYPE, ");
		sql.append(" TRANSNO, ");
		sql.append(" TRANSMARKET, ");
		sql.append(" GH_PRINTTIME, ");
		sql.append(" MARKETTYPE, ");
		sql.append(" VIN, ");
		sql.append(" TRANSFERPRICE, ");
		sql.append(" EXTENDEDPRICE, ");
		sql.append(" DOUBLETRANSFERPRICE, ");
		sql.append(" BASICCARID, ");
		sql.append(" MATERIALIMAGES1,  ");
		sql.append(" MATERIALIMAGES2,  ");
		sql.append(" MATERIALIMAGES3,  ");
		sql.append(" MATERIALIMAGES4,  ");
		sql.append(" MATERIALIMAGES5,  ");
		sql.append(" CHECKUSERID,  ");
		sql.append(" SERIAL  ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("  WHERE LICENSEPLATE=?  ");
		sql.append("  AND CARCLASS=2  ");
		sql.append("  AND STATUS<>16  ");
		sql.append("  AND STATUS<>0  ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, licenseplate);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setStatus(rs.getInt("STATUS"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setVin(rs.getString("VIN"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				dto.setSerial(rs.getString("SERIAL"));
			}
			return dto;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}

	}

	@Override
	public TransferAcceptedInfoDto getAssessInfoByVin(String vin) throws TmsDaoException {
		// TODO Auto-generated method stub
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("STATUS, ");
		sql.append(" OWNERTYPE, ");
		sql.append(" TRANSNO, ");
		sql.append(" TRANSMARKET, ");
		sql.append(" GH_PRINTTIME, ");
		sql.append(" MARKETTYPE, ");
		sql.append(" VIN, ");
		sql.append(" TRANSFERPRICE, ");
		sql.append(" EXTENDEDPRICE, ");
		sql.append(" DOUBLETRANSFERPRICE, ");
		sql.append(" BASICCARID, ");
		sql.append(" MATERIALIMAGES1,  ");
		sql.append(" MATERIALIMAGES2,  ");
		sql.append(" MATERIALIMAGES3,  ");
		sql.append(" MATERIALIMAGES4,  ");
		sql.append(" MATERIALIMAGES5,  ");
		sql.append(" CHECKUSERID,  ");
		sql.append(" SERIAL  ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("  WHERE VIN=?  ");
		sql.append("  AND CARCLASS=1  ");
		sql.append("  AND STATUS<>16  ");
		sql.append("  AND STATUS<>0  ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, vin);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setStatus(rs.getInt("STATUS"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setVin(rs.getString("VIN"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				dto.setSerial(rs.getString("SERIAL"));
			}
			return dto;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}

	}

	@Override
	public TransferAcceptedInfoDto getAcceptInfoByVin(String vin) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" CARNAME, ");
		sql.append(" LICENSEACCEPTIME, ");
		sql.append(" NEWCAROWNERIDCARDNO, ");
		sql.append(" VENDORID, ");
		sql.append(" BRANDID, ");
		sql.append(" ISMATCH ");
		sql.append(" FROM  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE VIN='" + vin + "'");

		TransferAcceptedInfoDto r = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				r = new TransferAcceptedInfoDto();
				r.setCarName(rs.getString("CARNAME"));
				r.setVendorId(rs.getString("VENDORID"));
				r.setBrandId(rs.getString("BRANDID"));
				r.setIsMatch(rs.getInt("ISMATCH"));
				r.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
				r.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
			}
			return r;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateTwiceTransPriceBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" STATUS=?,");
			sql.append(" DOUBLETRANSFERPRICE=?,");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" UPDATETIME=SYSDATE()");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getStatus());
			ps.setInt(2, dto.getDoubleTransferPrice());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setString(4, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateOwnerInfoBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" CAROWNERIDCARDNO=?,");
			sql.append(" OWNERADDRESS=?,");
			sql.append(" OWNERPHONE=?,");
			sql.append(" NEWOWNERMAILADDRESS=?,");
			sql.append(" NEWOWNERZIPCODE=?,");
			sql.append(" MOVEOUTPROVINCE=?,");
			sql.append(" MOVEOUTCITY=?,");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" UPDATETIME=SYSDATE()");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getCarOwnerIdCardNo());
			ps.setString(2, dto.getOwnerAddress());
			ps.setString(3, dto.getOwnerPhone());
			ps.setString(4, dto.getMailAddress());
			ps.setString(5, dto.getZipCode());
			ps.setString(6, dto.getMoveOutProvince());
			ps.setString(7, dto.getMoveOutCity());
			ps.setInt(8, dto.getUpdateUserId());
			ps.setString(9, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}
	
	

	@Override
	public List<TransferAcceptedInfoDto> getAcceptInfoBySerialAndLicense4StatusControl(String serial, String license, String vin)
			throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> list = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("ID, ");
		sql.append("MARKETTYPE, ");
		sql.append("SERIAL,    ");
		sql.append("VIN,    ");
		sql.append("LICENSEPLATE,    ");
		sql.append("STATUS,    ");
		sql.append("BASICCARID,    ");
		sql.append("CHANGEUSENATURE,    ");
		sql.append("CHECKFILESTATUS,    ");
		sql.append("INSERTTIME,    ");
		sql.append("CAROWNER    ");
		sql.append(" FROM  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE 1=1 ");
		if (vin != null && !"".equals(vin)) {
			sql.append(" AND VIN = '" + vin + "'  ");
		}
		if (serial != null && !"".equals(serial)) {
			sql.append(" AND SERIAL = '" + serial + "'  ");
		}
		if (license != null && !"".equals(license)) {
			sql.append(" AND LICENSEPLATE = '" + license + "'  ");
		}
		sql.append(" ORDER BY INSERTTIME DESC  ");
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto carDto = new TransferAcceptedInfoDto();
				carDto.setMarketType(rs.getInt("MARKETTYPE"));
				carDto.setSerial(rs.getString("SERIAL"));
				carDto.setVin(rs.getString("VIN"));
				carDto.setLicensePlate(rs.getString("LICENSEPLATE"));
				carDto.setStatus(rs.getInt("STATUS"));
				carDto.setBasicCarId(rs.getString("BASICCARID"));
				carDto.setInsertTimeS(DateUtil.getTimeByTimeStamp1(rs.getTimestamp("INSERTTIME")));
				carDto.setCarOwner(rs.getString("CAROWNER"));
				carDto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				carDto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS"));
				list.add(carDto);
			}
			return list;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public List<TransferAcceptedInfoDto> getAcceptInfoBySerialAndLicense(String serial, String license, String vin) throws TmsDaoException {

		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> list = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("ID, ");
		sql.append("MARKETTYPE, ");
		sql.append("SERIAL,    ");
		sql.append("VIN,    ");
		sql.append("LICENSEPLATE,    ");
		sql.append("STATUS,    ");
		sql.append("BASICCARID,    ");
		sql.append("CHANGEUSENATURE,    ");
		sql.append("CHECKFILESTATUS,    ");
		sql.append("INSERTTIME,    ");
		sql.append("CAROWNER    ");
		sql.append(" FROM  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE 1=1 ");
		if (vin != null && !"".equals(vin)) {
			sql.append(" AND VIN = '" + vin + "'  ");
		}
		if (serial != null && !"".equals(serial)) {
			sql.append(" AND SERIAL = '" + serial + "'  ");
		}
		if (license != null && !"".equals(license)) {
			sql.append(" AND LICENSEPLATE = '" + license + "'  ");
		}
		sql.append(" ORDER BY INSERTTIME DESC  ");
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto carDto = new TransferAcceptedInfoDto();
				carDto.setMarketType(rs.getInt("MARKETTYPE"));
				carDto.setSerial(rs.getString("SERIAL"));
				carDto.setVin(rs.getString("VIN"));
				carDto.setLicensePlate(rs.getString("LICENSEPLATE"));
				carDto.setStatus(rs.getInt("STATUS"));
				carDto.setBasicCarId(rs.getString("BASICCARID"));
				carDto.setInsertTimeS(DateUtil.getTimeByTimeStamp1(rs.getTimestamp("INSERTTIME")));
				carDto.setCarOwner(rs.getString("CAROWNER"));
				carDto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				carDto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS"));
				list.add(carDto);
			}
			return list;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public ArrayList<TransferAcceptedInfoDto> getAllAcceptInfoBySerial(String serial, String licensePlate)
			throws TmsDaoException {
		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("A.ID, ");
		sql.append("A.SERIAL, ");
		sql.append("A.MARKETTYPE, ");
		sql.append("A.BASICCARID, ");
		sql.append("A.LICENSEPLATE, ");
		sql.append("A.VIN, ");
		sql.append("A.CY_CARDTYPE, ");
		sql.append("A.CARCLASS, ");
		sql.append("A.TRANSFER, ");
		sql.append("A.CHANGEUSENATURE, ");
		sql.append("A.REPEATVIN, ");
		sql.append("A.REPEATENGINENUM, ");
		sql.append("A.CHANGEALLCAR, ");
		sql.append("A.APPLYCERTIFICATE, ");
		sql.append("A.REPLACEMENTCERTIFICATE, ");
		sql.append("A.MONITORINGSALES, ");
		sql.append("A.OTHER, ");
		sql.append("A.VINNUM, ");
		sql.append("A.ENGINENUM, ");
		sql.append("A.BRANDMODEL, ");
		sql.append("A.CY_COLOR, ");
		sql.append("A.CY_PASSENGER, ");
		sql.append("A.CY_CARTYPE, ");
		sql.append("A.PLATEORTIREEXTERIOR, ");
		sql.append("A.TIREINTACT, ");
		sql.append("A.SEATBELT, ");
		sql.append("A.NUMBERAXES, ");
		sql.append("A.TIRESIZE, ");
		sql.append("A.LATERALPORTIONOF, ");
		sql.append("A.REFLECTIVEMARK, ");
		sql.append("A.FIREEXTINGUISHER, ");
		sql.append("A.DRIVINGRECORD, ");
		sql.append("A.SECURITY, ");
		sql.append("A.EXTERNALMARKING, ");
		sql.append("A.SIREN, ");
		sql.append("A.SECURITYTECHNOLOGY, ");
		sql.append("A.CHECKCONCLUSION, ");
		sql.append("A.PHOTO_1, ");
		sql.append("A.PHOTO_2, ");
		sql.append("A.PHOTO_3, ");
		sql.append("A.PHOTO_4, ");
		sql.append("A.REMARK, ");
		sql.append("A.LC_PRINTNUM, ");
		sql.append("A.LC_PRINTUSERID, ");
		sql.append("A.CY_PRINTNUM, ");
		sql.append("A.CY_PRINTUSERID, ");
		sql.append("A.PG_PRICE, ");
		sql.append("A.PG_PRINTNUM, ");
		sql.append("A.PG_PRINTUSERID, ");
		sql.append("A.DB_PRINTNUM, ");
		sql.append("A.DB_PRINTUSERID, ");
		sql.append("A.OWNERTYPE, ");
		sql.append("A.CAROWNER, ");
		sql.append("A.OWNERPHONE, ");
		sql.append("A.OWNERADDRESS, ");
		sql.append("A.OWNERORGNO, ");
		sql.append("A.AGENTNAME, ");
		sql.append("A.AGENTOWNERIDCARDNO, ");
		sql.append("A.AGENTADDRESS, ");
		sql.append("A.AGENTPHONE, ");
		sql.append("A.NEWOWNERTYPE, ");
		sql.append("A.NEWCAROWNER, ");
		sql.append("A.NEWCAROWNERIDCARDNO, ");
		sql.append("A.NEWOWNERPHONE, ");
		sql.append("A.NEWOWNERTELPHONE, ");
		sql.append("A.NEWOWNERADDRESS, ");
		sql.append("A.NEWOWNERORGNO, ");
		sql.append("A.NEWOWNERZIPCODE, ");
		sql.append("A.NEWOWNERMAILADDRESS, ");
		sql.append("A.NEWAGENTNAME, ");
		sql.append("A.NEWAGENTOWNERIDCARDNO, ");
		sql.append("A.NEWAGENTADDRESS, ");
		sql.append("A.NEWAGENTPHONE, ");
		sql.append("A.OWNERSGROUPPHOTO, ");
		sql.append("A.MATERIALIMAGES1, ");
		sql.append("A.MATERIALIMAGES2, ");
		sql.append("A.MATERIALIMAGES3, ");
		sql.append("A.MATERIALIMAGES4, ");
		sql.append("A.MATERIALIMAGES5, ");
		sql.append("A.MATERIALIMAGES6, ");
		sql.append("A.MATERIALIMAGES7, ");
		sql.append("A.MATERIALIMAGES8, ");
		sql.append("A.MATERIALIMAGES9, ");
		sql.append("A.MATERIALIMAGES10, ");
		sql.append("A.PRICE, ");
		sql.append("A.TRANSFERPRICE, ");
		sql.append("A.EXTENDEDPRICE, ");
		sql.append("A.DOUBLETRANSFERPRICE, ");
		sql.append("A.SOURCETYPE, ");
		sql.append("A.STATUS, ");
		sql.append("A.AGENTTIME, ");
		sql.append("A.GH_PRINTNUM, ");
		sql.append("A.GH_PRINTUSERID, ");
		sql.append("A.ZY_PRINTNUM, ");
		sql.append("A.ZY_PRINTUSERID, ");
		sql.append("A.LZ_PRINTNUM, ");
		sql.append("A.LZ_PRINTUSERID, ");
		sql.append("A.XS_PRINTNUM, ");
		sql.append("A.XS_PRINTUSERID, ");
		sql.append("A.TRANSFERTYPE, ");
		sql.append("A.CARMARKETIN, ");
		sql.append("A.MOVEOUTPROVINCE, ");
		sql.append("A.MOVEOUTCITY, ");
		sql.append("A.TAXNO, ");
		sql.append("A.TRANSNO, ");
		sql.append("A.TRANSMARKET, ");
		sql.append("A.PAYMENTPEOPLE, ");
		sql.append("A.LICENSEACCEPTIME, ");
		sql.append("A.GAINTYPE, ");//
		sql.append("A.ATTNID, ");
		sql.append("A.INSERTUSERID, ");
		sql.append("A.LC_PRINTTIME, ");
		sql.append("A.CY_PRINTTIME, ");
		sql.append("A.PG_TIME, ");
		sql.append("A.PG_PRINTTIME, ");
		sql.append("A.DB_PRINTTIME, ");
		sql.append("A.GH_PRINTTIME, ");
		sql.append("A.ZY_PRINTTIME, ");
		sql.append("A.LZ_PRINTTIME, ");
		sql.append("A.XS_PRINTTIME, ");
		sql.append("A.INSERTTIME, ");
		sql.append("A.UPDATEUSERID, ");
		sql.append("A.UPDATETIME, ");
		sql.append("A.PRETRANSFER, ");
		sql.append("A.CHANGETRADETICKET, ");
		sql.append("A.REGISTRATION, ");
		sql.append("A.TRANSFERREGISTER, ");
		sql.append("A.CHANGESVACATE, ");
		sql.append("A.WAITFORSTATUS, ");
		sql.append("A.CHECKUSERID,  ");
		sql.append("A.PICCHANGENUM, ");
		sql.append("A.CHECKFILESTATUS, ");
		sql.append("A.MEMBERID, ");
		sql.append("A.ISMATCH, ");
		sql.append("B.REALNAME, ");
		sql.append("A.MODELCODE, ");
		sql.append("A.VENDORCODE, ");
		sql.append("C.COUNTRYSTYLE, ");
		sql.append("C.CARTYPE, ");
		sql.append("C.CARUSE, ");
		sql.append("C.CARDTYPE, ");
		sql.append("C.REGISTERCARDNO, ");
		sql.append("C.CAROWNERIDCARDNO, ");
		sql.append("C.REGISTERCARDNO, ");
		sql.append("A.REGDATE, ");
		sql.append("A.ATTACHMEMBERID, ");
		sql.append("B.SHORTNAME ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A" + " LEFT JOIN " + TmsTableNames.TMS_MEMBER
				+ " B on(A.MEMBERID = B.MEMBERID)");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_BASE_CAR_INFO + " C ON (A.VIN = C.VIN) ");
		sql.append("   WHERE 1=1 ");
		sql.append("   AND A.STATUS <> 16 "); // 过户完了
		sql.append("   AND A.STATUS <> 0 "); // 业务作废
		if (serial != null && !"".equals(serial)) {
			sql.append("   AND A.SERIAL =" + serial + " ");
		}
		if (licensePlate != null && !"".equals(licensePlate)) {
			sql.append("   AND A.LICENSEPLATE ='" + licensePlate + "' ");
		}
		sql.append(" ORDER BY A.INSERTTIME ASC  ");

		ArrayList<TransferAcceptedInfoDto> list = new ArrayList<TransferAcceptedInfoDto>();
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
				dto.setPg_price(rs.getInt("PG_PRICE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
				dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
				dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setMaterialImages6(rs.getString("MATERIALIMAGES6"));
				dto.setMaterialImages7(rs.getString("MATERIALIMAGES7"));
				dto.setMaterialImages8(rs.getString("MATERIALIMAGES8"));
				dto.setMaterialImages9(rs.getString("MATERIALIMAGES9"));
				dto.setMaterialImages10(rs.getString("MATERIALIMAGES10"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
				dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setCarMarketIn(rs.getString("CARMARKETIN"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
				dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setInsertUserid(rs.getInt("INSERTUSERID"));
				dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
				dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
				dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
				dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
				dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
				dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
				dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setPreTransfer(rs.getInt("PRETRANSFER"));
				dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
				dto.setMemberId(rs.getString("MEMBERID"));
				dto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS"));
				dto.setMemberRealName(rs.getString("REALNAME"));
				dto.setIsMatch(rs.getInt("ISMATCH"));
				dto.setModelCode(rs.getString("MODELCODE"));
				dto.setVendorCode(rs.getString("VENDORCODE"));
				dto.setCarType(rs.getString("CARTYPE"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setCarUse(rs.getString("CARUSE"));
				dto.setCountryStyle(rs.getString("COUNTRYSTYLE"));
				dto.setRegisterCardNo(rs.getString("REGISTERCARDNO"));
				dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
				dto.setRegDate(rs.getTimestamp("REGDATE"));
				dto.setAttachMemberId(rs.getString("ATTACHMEMBERID"));
				dto.setShortName(rs.getString("SHORTNAME"));
				list.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return list;
	}

	@Override
	public TransferAcceptedInfoDto getAcceptInfoBySerial(String serial) throws TmsDaoException {
		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("A.ID, ");
		sql.append("A.SERIAL, ");
		sql.append("A.MARKETTYPE, ");
		sql.append("A.BASICCARID, ");
		sql.append("A.LICENSEPLATE, ");
		sql.append("A.VIN, ");
		sql.append("A.CY_CARDTYPE, ");
		sql.append("A.CARCLASS, ");
		sql.append("A.TRANSFER, ");
		sql.append("A.CHANGEUSENATURE, ");
		sql.append("A.REPEATVIN, ");
		sql.append("A.REPEATENGINENUM, ");
		sql.append("A.CHANGEALLCAR, ");
		sql.append("A.APPLYCERTIFICATE, ");
		sql.append("A.REPLACEMENTCERTIFICATE, ");
		sql.append("A.MONITORINGSALES, ");
		sql.append("A.OTHER, ");
		sql.append("A.VINNUM, ");
		sql.append("A.ENGINENUM, ");
		sql.append("A.BRANDMODEL, ");
		sql.append("A.CY_COLOR, ");
		sql.append("A.CY_PASSENGER, ");
		sql.append("A.CY_CARTYPE, ");
		sql.append("A.PLATEORTIREEXTERIOR, ");
		sql.append("A.TIREINTACT, ");
		sql.append("A.SEATBELT, ");
		sql.append("A.NUMBERAXES, ");
		sql.append("A.TIRESIZE, ");
		sql.append("A.LATERALPORTIONOF, ");
		sql.append("A.REFLECTIVEMARK, ");
		sql.append("A.FIREEXTINGUISHER, ");
		sql.append("A.DRIVINGRECORD, ");
		sql.append("A.SECURITY, ");
		sql.append("A.EXTERNALMARKING, ");
		sql.append("A.SIREN, ");
		sql.append("A.SECURITYTECHNOLOGY, ");
		sql.append("A.CHECKCONCLUSION, ");
		sql.append("A.PHOTO_1, ");
		sql.append("A.PHOTO_2, ");
		sql.append("A.PHOTO_3, ");
		sql.append("A.PHOTO_4, ");
		sql.append("A.REMARK, ");
		sql.append("A.LC_PRINTNUM, ");
		sql.append("A.LC_PRINTUSERID, ");
		sql.append("A.CY_PRINTNUM, ");
		sql.append("A.CY_PRINTUSERID, ");
		sql.append("A.PG_PRICE, ");
		sql.append("A.PG_PRINTNUM, ");
		sql.append("A.PG_PRINTUSERID, ");
		sql.append("A.DB_PRINTNUM, ");
		sql.append("A.DB_PRINTUSERID, ");
		sql.append("A.OWNERTYPE, ");
		sql.append("A.CAROWNER, ");
		sql.append("A.CAROWNERIDCARDNO, ");
		sql.append("A.OWNERPHONE, ");
		sql.append("A.OWNERADDRESS, ");
		sql.append("A.OWNERORGNO, ");
		sql.append("A.AGENTNAME, ");
		sql.append("A.AGENTOWNERIDCARDNO, ");
		sql.append("A.AGENTADDRESS, ");
		sql.append("A.AGENTPHONE, ");
		sql.append("A.NEWOWNERTYPE, ");
		sql.append("A.NEWCAROWNER, ");
		sql.append("A.NEWCAROWNERIDCARDNO, ");
		sql.append("A.NEWOWNERPHONE, ");
		sql.append("A.NEWOWNERTELPHONE, ");
		sql.append("A.NEWOWNERADDRESS, ");
		sql.append("A.NEWOWNERORGNO, ");
		sql.append("A.NEWOWNERZIPCODE, ");
		sql.append("A.NEWOWNERMAILADDRESS, ");
		sql.append("A.NEWAGENTNAME, ");
		sql.append("A.NEWAGENTOWNERIDCARDNO, ");
		sql.append("A.NEWAGENTADDRESS, ");
		sql.append("A.NEWAGENTPHONE, ");
		sql.append("A.OWNERSGROUPPHOTO, ");
		sql.append("A.MATERIALIMAGES1, ");
		sql.append("A.MATERIALIMAGES2, ");
		sql.append("A.MATERIALIMAGES3, ");
		sql.append("A.MATERIALIMAGES4, ");
		sql.append("A.MATERIALIMAGES5, ");
		sql.append("A.PRICE, ");
		sql.append("A.TRANSFERPRICE, ");
		sql.append("A.EXTENDEDPRICE, ");
		sql.append("A.DOUBLETRANSFERPRICE, ");
		sql.append("A.SOURCETYPE, ");
		sql.append("A.STATUS, ");
		sql.append("A.AGENTTIME, ");
		sql.append("A.GH_PRINTNUM, ");
		sql.append("A.GH_PRINTUSERID, ");
		sql.append("A.ZY_PRINTNUM, ");
		sql.append("A.ZY_PRINTUSERID, ");
		sql.append("A.LZ_PRINTNUM, ");
		sql.append("A.LZ_PRINTUSERID, ");
		sql.append("A.XS_PRINTNUM, ");
		sql.append("A.XS_PRINTUSERID, ");
		sql.append("A.TRANSFERTYPE, ");
		sql.append("A.CARMARKETIN, ");
		sql.append("A.MOVEOUTPROVINCE, ");
		sql.append("A.MOVEOUTCITY, ");
		sql.append("A.TAXNO, ");
		sql.append("A.TRANSNO, ");
		sql.append("A.TRANSMARKET, ");
		sql.append("A.PAYMENTPEOPLE, ");
		sql.append("A.LICENSEACCEPTIME, ");
		sql.append("A.GAINTYPE, ");//
		sql.append("A.ATTNID, ");
		sql.append("A.INSERTUSERID, ");
		sql.append("A.LC_PRINTTIME, ");
		sql.append("A.CY_PRINTTIME, ");
		sql.append("A.PG_TIME, ");
		sql.append("A.PG_PRINTTIME, ");
		sql.append("A.DB_PRINTTIME, ");
		sql.append("A.GH_PRINTTIME, ");
		sql.append("A.ZY_PRINTTIME, ");
		sql.append("A.LZ_PRINTTIME, ");
		sql.append("A.XS_PRINTTIME, ");
		sql.append("A.INSERTTIME, ");
		sql.append("A.UPDATEUSERID, ");
		sql.append("A.UPDATETIME, ");
		sql.append("A.PRETRANSFER, ");
		sql.append("A.CHANGETRADETICKET, ");
		sql.append("A.REGISTRATION, ");
		sql.append("A.TRANSFERREGISTER, ");
		sql.append("A.CHANGESVACATE, ");
		sql.append("A.WAITFORSTATUS, ");
		sql.append("A.CHECKUSERID,  ");
		sql.append("A.PICCHANGENUM, ");
		sql.append("A.CHECKFILESTATUS, ");
		sql.append("A.MEMBERID, ");
		// #104 START
		sql.append("A.ISMATCH, ");
		sql.append("A.VENDORID, ");
		// #104 E N D
		sql.append("B.REALNAME, ");
		sql.append("C.TRANSFERPRICEDATE, ");
		sql.append("C.CHECKPRICEDATE ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A" + " LEFT JOIN " + TmsTableNames.TMS_MEMBER
				+ " B on(A.MEMBERID = B.MEMBERID)");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_TRANSFER_FINANCE_INFO + " C ON (A.SERIAL = C.SERIAL) ");
		sql.append("   WHERE 1=1 ");
		if (serial != null && !"".equals(serial)) {
			sql.append("   AND A.SERIAL =" + serial + " ");
		}
		sql.append(" ORDER BY A.INSERTTIME ASC  ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setCarType(rs.getString("CY_CARTYPE"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
				dto.setPg_price(rs.getInt("PG_PRICE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
				dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
				dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
				dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setCarMarketIn(rs.getString("CARMARKETIN"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
				dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setInsertUserid(rs.getInt("INSERTUSERID"));
				dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
				dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
				dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
				dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
				dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
				dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
				dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setPreTransfer(rs.getInt("PRETRANSFER"));
				dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
				dto.setMemberId(rs.getString("MEMBERID")); // add by huangwei
				dto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS")); // add by
																		// huangheli
				dto.setMemberRealName(rs.getString("REALNAME"));
				dto.setTransferPriceDate(rs.getTimestamp("TRANSFERPRICEDATE"));
				dto.setCheckPriceDate(rs.getTimestamp("CHECKPRICEDATE"));
				// #104 START
				dto.setIsMatch(rs.getInt("ISMATCH"));
				dto.setVendorId(rs.getString("VENDORID"));
				// #104 E N D
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}
	@Override
	public TransferAcceptedInfoDto getAcceptInfoBySerial(String serial, String licensePlate) throws TmsDaoException {
		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("A.ID, ");
		sql.append("A.SERIAL, ");
		sql.append("A.MARKETTYPE, ");
		sql.append("A.BASICCARID, ");
		sql.append("A.LICENSEPLATE, ");
		sql.append("A.VIN, ");
		sql.append("A.CY_CARDTYPE, ");
		sql.append("A.CARCLASS, ");
		sql.append("A.TRANSFER, ");
		sql.append("A.CHANGEUSENATURE, ");
		sql.append("A.REPEATVIN, ");
		sql.append("A.REPEATENGINENUM, ");
		sql.append("A.CHANGEALLCAR, ");
		sql.append("A.APPLYCERTIFICATE, ");
		sql.append("A.REPLACEMENTCERTIFICATE, ");
		sql.append("A.MONITORINGSALES, ");
		sql.append("A.OTHER, ");
		sql.append("A.VINNUM, ");
		sql.append("A.ENGINENUM, ");
		sql.append("A.BRANDMODEL, ");
		sql.append("A.CY_COLOR, ");
		sql.append("A.CY_PASSENGER, ");
		sql.append("A.CY_CARTYPE, ");
		sql.append("A.PLATEORTIREEXTERIOR, ");
		sql.append("A.TIREINTACT, ");
		sql.append("A.SEATBELT, ");
		sql.append("A.NUMBERAXES, ");
		sql.append("A.TIRESIZE, ");
		sql.append("A.LATERALPORTIONOF, ");
		sql.append("A.REFLECTIVEMARK, ");
		sql.append("A.FIREEXTINGUISHER, ");
		sql.append("A.DRIVINGRECORD, ");
		sql.append("A.SECURITY, ");
		sql.append("A.EXTERNALMARKING, ");
		sql.append("A.SIREN, ");
		sql.append("A.SECURITYTECHNOLOGY, ");
		sql.append("A.CHECKCONCLUSION, ");
		sql.append("A.PHOTO_1, ");
		sql.append("A.PHOTO_2, ");
		sql.append("A.PHOTO_3, ");
		sql.append("A.PHOTO_4, ");
		sql.append("A.REMARK, ");
		sql.append("A.LC_PRINTNUM, ");
		sql.append("A.LC_PRINTUSERID, ");
		sql.append("A.CY_PRINTNUM, ");
		sql.append("A.CY_PRINTUSERID, ");
		sql.append("A.PG_PRICE, ");
		sql.append("A.PG_PRINTNUM, ");
		sql.append("A.PG_PRINTUSERID, ");
		sql.append("A.DB_PRINTNUM, ");
		sql.append("A.DB_PRINTUSERID, ");
		sql.append("A.OWNERTYPE, ");
		sql.append("A.CAROWNER, ");
		sql.append("A.CAROWNERIDCARDNO, ");
		sql.append("A.OWNERPHONE, ");
		sql.append("A.OWNERADDRESS, ");
		sql.append("A.OWNERORGNO, ");
		sql.append("A.AGENTNAME, ");
		sql.append("A.AGENTOWNERIDCARDNO, ");
		sql.append("A.AGENTADDRESS, ");
		sql.append("A.AGENTPHONE, ");
		sql.append("A.NEWOWNERTYPE, ");
		sql.append("A.NEWCAROWNER, ");
		sql.append("A.NEWCAROWNERIDCARDNO, ");
		sql.append("A.NEWOWNERPHONE, ");
		sql.append("A.NEWOWNERTELPHONE, ");
		sql.append("A.NEWOWNERADDRESS, ");
		sql.append("A.NEWOWNERORGNO, ");
		sql.append("A.NEWOWNERZIPCODE, ");
		sql.append("A.NEWOWNERMAILADDRESS, ");
		sql.append("A.NEWAGENTNAME, ");
		sql.append("A.NEWAGENTOWNERIDCARDNO, ");
		sql.append("A.NEWAGENTADDRESS, ");
		sql.append("A.NEWAGENTPHONE, ");
		sql.append("A.OWNERSGROUPPHOTO, ");
		sql.append("A.MATERIALIMAGES1, ");
		sql.append("A.MATERIALIMAGES2, ");
		sql.append("A.MATERIALIMAGES3, ");
		sql.append("A.MATERIALIMAGES4, ");
		sql.append("A.MATERIALIMAGES5, ");
		sql.append("A.PRICE, ");
		sql.append("A.TRANSFERPRICE, ");
		sql.append("A.EXTENDEDPRICE, ");
		sql.append("A.DOUBLETRANSFERPRICE, ");
		sql.append("A.SOURCETYPE, ");
		sql.append("A.STATUS, ");
		sql.append("A.AGENTTIME, ");
		sql.append("A.GH_PRINTNUM, ");
		sql.append("A.GH_PRINTUSERID, ");
		sql.append("A.ZY_PRINTNUM, ");
		sql.append("A.ZY_PRINTUSERID, ");
		sql.append("A.LZ_PRINTNUM, ");
		sql.append("A.LZ_PRINTUSERID, ");
		sql.append("A.XS_PRINTNUM, ");
		sql.append("A.XS_PRINTUSERID, ");
		sql.append("A.TRANSFERTYPE, ");
		sql.append("A.CARMARKETIN, ");
		sql.append("A.MOVEOUTPROVINCE, ");
		sql.append("A.MOVEOUTCITY, ");
		sql.append("A.TAXNO, ");
		sql.append("A.TRANSNO, ");
		sql.append("A.TRANSMARKET, ");
		sql.append("A.PAYMENTPEOPLE, ");
		sql.append("A.LICENSEACCEPTIME, ");
		sql.append("A.GAINTYPE, ");//
		sql.append("A.ATTNID, ");
		sql.append("A.INSERTUSERID, ");
		sql.append("A.LC_PRINTTIME, ");
		sql.append("A.CY_PRINTTIME, ");
		sql.append("A.PG_TIME, ");
		sql.append("A.PG_PRINTTIME, ");
		sql.append("A.DB_PRINTTIME, ");
		sql.append("A.GH_PRINTTIME, ");
		sql.append("A.ZY_PRINTTIME, ");
		sql.append("A.LZ_PRINTTIME, ");
		sql.append("A.XS_PRINTTIME, ");
		sql.append("A.INSERTTIME, ");
		sql.append("A.UPDATEUSERID, ");
		sql.append("A.UPDATETIME, ");
		sql.append("A.PRETRANSFER, ");
		sql.append("A.CHANGETRADETICKET, ");
		sql.append("A.REGISTRATION, ");
		sql.append("A.TRANSFERREGISTER, ");
		sql.append("A.CHANGESVACATE, ");
		sql.append("A.WAITFORSTATUS, ");
		sql.append("A.CHECKUSERID,  ");
		sql.append("A.PICCHANGENUM, ");
		sql.append("A.CHECKFILESTATUS, ");
		sql.append("A.MEMBERID, ");
		sql.append("A.CARUSE, ");
		// #104 START
		sql.append("A.ISMATCH, ");
		sql.append("A.VENDORID, ");
		// #104 E N D
		sql.append("B.REALNAME, ");
		sql.append("C.TRANSFERPRICEDATE, ");
		sql.append("C.CHECKPRICEDATE ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A" + " LEFT JOIN " + TmsTableNames.TMS_MEMBER
				+ " B on(A.MEMBERID = B.MEMBERID)");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_TRANSFER_FINANCE_INFO + " C ON (A.SERIAL = C.SERIAL) ");
		sql.append("   WHERE 1=1 ");
		sql.append("   AND A.STATUS <> 16 AND A.STATUS <> 0"); // 16:过户完了  0:业务作废
		if (serial != null && !"".equals(serial)) {
			sql.append("   AND A.SERIAL =" + serial + " ");
		}
		if (licensePlate != null && !"".equals(licensePlate)) {
			sql.append("   AND A.LICENSEPLATE ='" + licensePlate + "' ");
		}
		sql.append(" ORDER BY A.INSERTTIME ASC  ");

		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setCarType(rs.getString("CY_CARTYPE"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
				dto.setPg_price(rs.getInt("PG_PRICE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
				dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
				dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
				dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setCarMarketIn(rs.getString("CARMARKETIN"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
				dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setInsertUserid(rs.getInt("INSERTUSERID"));
				dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
				dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
				dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
				dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
				dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
				dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
				dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setPreTransfer(rs.getInt("PRETRANSFER"));
				dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
				dto.setMemberId(rs.getString("MEMBERID")); // add by huangwei
				dto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS")); // add by
																		// huangheli
				dto.setMemberRealName(rs.getString("REALNAME"));
				dto.setTransferPriceDate(rs.getTimestamp("TRANSFERPRICEDATE"));
				dto.setCheckPriceDate(rs.getTimestamp("CHECKPRICEDATE"));
				// #104 START
				dto.setIsMatch(rs.getInt("ISMATCH"));
				dto.setVendorId(rs.getString("VENDORID"));
				dto.setCarUse(rs.getString("CARUSE"));
				// #104 E N D
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	@Override
	public void updateTransExtendPriceByEntity(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" STATUS=?,");
			sql.append(" EXTENDEDPRICE=?,");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" UPDATETIME=SYSDATE(), ");
			sql.append(" AGENTTIME=SYSDATE(), ");
			sql.append(" WAITFORSTATUS=?  ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getStatus());
			ps.setInt(2, dto.getExtendedPrice());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setInt(4, dto.getWaitForStatus());
			ps.setString(5, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePrintInfoBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" PG_PRINTNUM=?,   ");
			sql.append(" PG_PRINTTIME=SYSDATE(),   ");
			sql.append(" PG_PRINTUSERID=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getPg_printNum());
			ps.setInt(2, dto.getPg_printUserId());
			ps.setString(3, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePrintInfoBySerialDb(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" DB_PRINTNUM=?,   ");
			sql.append(" DB_PRINTTIME=SYSDATE(),   ");
			sql.append(" DB_PRINTUSERID=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getDb_printNum());
			ps.setInt(2, dto.getDb_printUserId());
			ps.setString(3, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePrintInfoBySerialZy(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" ZY_PRINTNUM=?,   ");
			sql.append(" ZY_PRINTTIME=SYSDATE(),   ");
			sql.append(" ZY_PRINTUSERID=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getZy_printnum());
			ps.setInt(2, dto.getZy_printUserId());
			ps.setString(3, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePrintInfoBySerialLc(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" LC_PRINTNUM=?,   ");
			sql.append(" LC_PRINTTIME=SYSDATE(),   ");
			sql.append(" CY_PRINTTIME=SYSDATE(),");
			sql.append(" LC_PRINTUSERID=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getLc_printNum());
			ps.setInt(2, dto.getLc_printUserId());
			ps.setString(3, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePrintInfoBySerialGh(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" GH_PRINTNUM=?,   ");
			sql.append(" GH_PRINTTIME=SYSDATE(),   ");
			sql.append(" GH_PRINTUSERID=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getGh_printnum());
			ps.setInt(2, dto.getGh_printUserId());
			ps.setString(3, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateTransferPriceBySerial(int businessType, int transferPriceChargeType,String serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			if(businessType == 1){//收费
	            if (1 == transferPriceChargeType) {
	                sql.append(" changeEngine=1, ");
	                sql.append(" changeColor=1 ");
	            } else if (2 == transferPriceChargeType) {
	                sql.append(" changesVacate=1, ");
	                sql.append(" changeEngine=1 ");
	            }  
	            else if (9 == transferPriceChargeType) {
					sql.append(" TRANSFERPRICE=1, ");
	                sql.append(" PAYTIME=SYSDATE() ");
	            }
				else if (10 == transferPriceChargeType) {
					sql.append(" EXTENDEDPRICE=1 ");
				}
				else if (11 == transferPriceChargeType) {
					sql.append(" EXTENDEDPRICE=1, ");
					sql.append(" WAITFORSTATUS=13 ");
				} else if (12 == transferPriceChargeType) {
					sql.append(" CHANGETRADETICKET=1 ");
				} else if (3 == transferPriceChargeType) {
	                sql.append(" changeTradeTicket=1, ");
	                sql.append(" monitoringSales=1 ");
	            }  else if (4 == transferPriceChargeType) {
	                sql.append(" changeTradeTicket=1, ");
	                sql.append(" other=1 ");
	            }  else if (5 == transferPriceChargeType) {
	                sql.append(" changeTradeTicket=1, ");
	                sql.append(" pg_printUserId=1 ");
	            } else if (6 == transferPriceChargeType || 7 == transferPriceChargeType || 8 == transferPriceChargeType) {
	                sql.append(" conformityMark=1 ");
	            } 
			}else{//退费
				if (1 == transferPriceChargeType) {
	                sql.append(" changeEngine=2, ");
	                sql.append(" changeColor=2 ");
	            } else if (2 == transferPriceChargeType) {
	                sql.append(" changesVacate=2, ");
	                sql.append(" changeEngine=2 ");
	            }  
	            else if (9 == transferPriceChargeType)
					sql.append(" TRANSFERPRICE=2 ");
				else if (10 == transferPriceChargeType)
					sql.append(" EXTENDEDPRICE=2 ");
				else if (11 == transferPriceChargeType) {
					sql.append(" EXTENDEDPRICE=2, ");
					sql.append(" WAITFORSTATUS=1 ");
				} else if (12 == transferPriceChargeType) {
					sql.append(" CHANGETRADETICKET=2 ");
				} else if (3 == transferPriceChargeType) {
	                sql.append(" changeTradeTicket=2, ");
	                sql.append(" monitoringSales=2 ");
	            }  else if (4 == transferPriceChargeType) {
	                sql.append(" changeTradeTicket=2, ");
	                sql.append(" other=2 ");
	            }  else if (5 == transferPriceChargeType) {
	                sql.append(" changeTradeTicket=2, ");
	                sql.append(" pg_printUserId=2 ");
	            } else if (6 == transferPriceChargeType || 7 == transferPriceChargeType || 8 == transferPriceChargeType) {
	                sql.append(" conformityMark=2 ");
	            } 
			}
			sql.append(" WHERE ");
			sql.append(" SERIAL='" + serial + "'");
			ps = conn.prepareStatement(sql.toString());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptStatusAloneBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" STATUS=?");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getStatus());
			ps.setString(2, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePrintInfoBySerialCy(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" CY_PRINTNUM=?,   ");
			sql.append(" CY_PRINTTIME=SYSDATE(),   ");
			sql.append(" CY_PRINTUSERID=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getCy_printNum());
			ps.setInt(2, dto.getCy_printUserId());
			ps.setString(3, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public TransferAcceptedInfoDto findTransferByBasicCarId(String basicCarId) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("SERIAL, ");
		sql.append("PHOTO_1, ");
		sql.append("PHOTO_2, ");
		sql.append("PHOTO_3, ");
		sql.append("PHOTO_4, ");
		sql.append("STATUS,");
		sql.append("CY_PRINTTIME, ");
		sql.append("PICCHANGENUM, ");
		sql.append("CHECKUSERID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("   WHERE BASICCARID =" + basicCarId);

		TransferAcceptedInfoDto dto = null;
		try {
			int i = 1;
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				if (i > 1) {
					break;
				}
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
				dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				i++;
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	@Override
	public void updatePadMarket(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" PHOTO_1=?,   ");
			sql.append(" PHOTO_2=?,   ");
			sql.append(" PHOTO_3=? ,  ");
			sql.append(" PHOTO_4=? ,  ");
			sql.append(" UPDATETIME=SYSDATE() ,  ");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" PICCHANGENUM=?,");
			sql.append(" PICCHANGETIME=SYSDATE(),");
			sql.append(" PICCHANGEUSERID=? ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getPhoto_1());
			ps.setString(2, dto.getPhoto_2());
			ps.setString(3, dto.getPhoto_3());
			ps.setString(4, dto.getPhoto_4());
			ps.setInt(5, dto.getUpdateUserId());
			ps.setInt(6, dto.getPicChangeNum());
			ps.setInt(7, dto.getPicChangeUserId());
			ps.setString(8, dto.getSerial());
			// ps.setString(parameterIndex, x);

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateTransferInfoAtReback(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" SERIAL=?,   ");
			sql.append(" STATUS=?,   ");
			sql.append(" UPDATEUSERID=?,");
			sql.append(" UPDATETIME=SYSDATE() ");
			sql.append(" WHERE id =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getSerial());
			ps.setInt(2, dto.getStatus());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setInt(4, dto.getId());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void insertTransInfoAtBeBack(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("INSERT INTO ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" (  ");
			sql.append(" VIN,  ");
			sql.append(" LICENSEPLATE,  ");
			sql.append(" CY_CARDTYPE,  ");
			sql.append(" VINNUM,  ");
			sql.append(" ENGINENUM,  ");
			sql.append(" CY_COLOR,  ");
			sql.append(" CY_PASSENGER,  ");
			sql.append(" CY_CARTYPE,  ");
			sql.append(" PLATEORTIREEXTERIOR,  ");
			sql.append(" TIREINTACT,  ");

			sql.append(" SEATBELT,  ");
			sql.append(" NUMBERAXES,  ");
			sql.append(" TIRESIZE,  ");
			sql.append(" LATERALPORTIONOF,  ");
			sql.append(" REFLECTIVEMARK,  ");
			sql.append(" FIREEXTINGUISHER,  ");
			sql.append(" DRIVINGRECORD,  ");
			sql.append(" SECURITY,  ");
			sql.append(" EXTERNALMARKING,  ");
			sql.append(" SIREN,  ");

			sql.append(" SECURITYTECHNOLOGY,  ");
			sql.append(" CHECKCONCLUSION,  ");
			sql.append(" INSERTUSERID,  ");
			sql.append(" INSERTTIME,  ");
			sql.append(" PHOTO_1,  ");
			sql.append(" PHOTO_2,  ");
			sql.append(" PHOTO_3,  ");
			sql.append(" PHOTO_4,  ");
			sql.append(" SERIAL,   ");
			sql.append(" MARKETTYPE,   ");
			sql.append(" STATUS,   ");

			sql.append(" BRANDMODEL,   ");
			sql.append(" OWNERTYPE,   ");
			sql.append(" CAROWNER,   ");
			sql.append(" CAROWNERIDCARDNO,   ");
			sql.append(" OWNERPHONE,   ");
			sql.append(" OWNERADDRESS,   ");
			sql.append(" OWNERORGNO,   ");
			sql.append(" TRANSFER,   ");
			sql.append(" CARCLASS,   ");
			sql.append(" BASICCARID,   ");

			sql.append(" UPDATETIME,  ");
			sql.append(" UPDATEUSERID,  ");

			sql.append(" REGISTRATION,  ");
			sql.append(" TRANSFERREGISTER,  ");
			sql.append(" CHANGESVACATE,  ");
			// 新加
			sql.append(" LC_PRINTNUM, ");
			sql.append(" LC_PRINTTIME, ");
			sql.append(" LC_PRINTUSERID, ");
			sql.append(" CY_PRINTNUM, ");
			sql.append(" CY_PRINTTIME, ");
			sql.append(" CY_PRINTUSERID, ");
			sql.append(" PG_PRICE, ");
			sql.append(" PG_TIME, ");
			sql.append(" PG_PRINTNUM, ");
			sql.append(" PG_PRINTTIME, ");
			sql.append(" PG_PRINTUSERID, ");
			sql.append(" AGENTNAME, ");
			sql.append(" AGENTOWNERIDCARDNO, ");
			sql.append(" AGENTADDRESS, ");
			sql.append(" AGENTPHONE, ");
			sql.append(" MATERIALIMAGES1, ");
			sql.append(" MATERIALIMAGES2, ");
			sql.append(" MATERIALIMAGES3, ");
			sql.append(" MATERIALIMAGES4, ");
			sql.append(" MATERIALIMAGES5, ");
			sql.append(" SOURCETYPE,  ");
			sql.append(" OWNERSGROUPPHOTO,  ");
			sql.append(" MEMBERID  "); // add by huangwei 20150919
			sql.append("  ) VALUES ( ");
			sql.append(" ?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?" + ",?,?,?,?,SYSDATE(),?,?,?,"
					+ "?,?,?,?,? ,?,?,?,? ,?," + "?,?,?,?,SYSDATE(),?,?,?,?," + "?,?,?,?,?,?,?,?,?,?,?,?,?,?,"
					+ "?,?,?,?,?,?,?,?,?  )");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getLicensePlate());
			ps.setInt(3, dto.getCardType());
			ps.setString(4, dto.getVinNum());
			ps.setString(5, dto.getEngineNum());
			ps.setString(6, dto.getCy_color());
			ps.setString(7, dto.getCy_passenger());
			ps.setString(8, dto.getCarType());
			ps.setString(9, dto.getPlateOrTireExterior());
			ps.setString(10, dto.getTireIntact());

			ps.setString(11, dto.getSeatBelt());
			ps.setString(12, dto.getNumberAxes());
			ps.setString(13, dto.getTireSize());
			ps.setString(14, dto.getLateralPortionOf());
			ps.setString(15, dto.getReflectiveMark());
			ps.setString(16, dto.getFireExtinguisher());
			ps.setString(17, dto.getDrivingRecord());
			ps.setString(18, dto.getSecurity());
			ps.setString(19, dto.getExternalMarking());
			ps.setString(20, dto.getSiren());
			ps.setString(21, dto.getSecurityTechnology());
			ps.setString(22, dto.getCheckConclusion());
			ps.setInt(23, dto.getInsertUserid());
			ps.setString(24, dto.getPhoto_1());
			ps.setString(25, dto.getPhoto_2());
			ps.setString(26, dto.getPhoto_3());
			ps.setString(27, dto.getPhoto_4());
			ps.setString(28, dto.getSerial());
			ps.setInt(29, dto.getMarketType());
			ps.setInt(30, dto.getStatus());
			ps.setString(31, dto.getBrandModel());
			ps.setInt(32, dto.getOwnerType());
			ps.setString(33, dto.getCarOwner());
			ps.setString(34, dto.getCarOwnerIdCardNo());
			ps.setString(35, dto.getOwnerPhone());
			ps.setString(36, dto.getOwnerAddress());
			ps.setString(37, dto.getOwnerOrgNo());
			ps.setInt(38, dto.getTransfer());
			ps.setInt(39, dto.getCarClass());
			ps.setString(40, dto.getBasicCarId());
			ps.setInt(41, dto.getUpdateUserId());
			ps.setInt(42, dto.getRegistration());
			ps.setInt(43, dto.getTransferRegister());
			ps.setInt(44, dto.getChangesVacate());

			ps.setInt(45, dto.getLc_printNum());
			ps.setTimestamp(46, dto.getLc_printTime());
			ps.setInt(47, dto.getLc_printUserId());
			ps.setInt(48, dto.getCy_printNum());
			ps.setTimestamp(49, dto.getCy_printTime());
			ps.setInt(50, dto.getCy_printUserId());
			ps.setInt(51, dto.getPg_price());
			ps.setString(52, dto.getPg_time());
			ps.setInt(53, dto.getPg_printNum());
			ps.setTimestamp(54, dto.getPg_printTime());
			ps.setInt(55, dto.getPg_printUserId());
			ps.setString(56, dto.getAgentName());
			ps.setString(57, dto.getAgentOwnerIdCardNo());
			ps.setString(58, dto.getAgentAddress());
			ps.setString(59, dto.getAgentPhone());
			ps.setString(60, dto.getMaterialImages1());
			ps.setString(61, dto.getMaterialImages2());
			ps.setString(62, dto.getMaterialImages3());
			ps.setString(63, dto.getMaterialImages4());
			ps.setString(64, dto.getMaterialImages5());
			ps.setInt(65, dto.getSourceType());
			ps.setString(66, dto.getOwnersGroupPhoto());
			ps.setString(67, dto.getMemberId()); // add by huangwei

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public TransferAcceptedInfoDto findByVinAtGh(String vin) throws TmsDaoException {
		// TODO Auto-generated method stub
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("ID, ");
		sql.append("SERIAL, ");
		sql.append("MARKETTYPE, ");
		sql.append("BASICCARID, ");
		sql.append("LICENSEPLATE, ");
		sql.append("VIN, ");
		sql.append("CY_CARDTYPE, ");
		sql.append("CARCLASS, ");
		sql.append("TRANSFER, ");
		sql.append("CHANGEUSENATURE, ");
		sql.append("REPEATVIN, ");
		sql.append("REPEATENGINENUM, ");
		sql.append("CHANGEALLCAR, ");
		sql.append("APPLYCERTIFICATE, ");
		sql.append("REPLACEMENTCERTIFICATE, ");
		sql.append("MONITORINGSALES, ");
		sql.append("OTHER, ");
		sql.append("VINNUM, ");
		sql.append("ENGINENUM, ");
		sql.append("BRANDMODEL, ");
		sql.append("CY_COLOR, ");
		sql.append("CY_PASSENGER, ");
		sql.append("CY_CARTYPE, ");
		sql.append("PLATEORTIREEXTERIOR, ");
		sql.append("TIREINTACT, ");
		sql.append("SEATBELT, ");
		sql.append("NUMBERAXES, ");
		sql.append("TIRESIZE, ");
		sql.append("LATERALPORTIONOF, ");
		sql.append("REFLECTIVEMARK, ");
		sql.append("FIREEXTINGUISHER, ");
		sql.append("DRIVINGRECORD, ");
		sql.append("SECURITY, ");
		sql.append("EXTERNALMARKING, ");
		sql.append("SIREN, ");
		sql.append("SECURITYTECHNOLOGY, ");
		sql.append("CHECKCONCLUSION, ");
		sql.append("PHOTO_1, ");
		sql.append("PHOTO_2, ");
		sql.append("PHOTO_3, ");
		sql.append("PHOTO_4, ");
		sql.append("REMARK, ");
		sql.append("LC_PRINTNUM, ");
		sql.append("LC_PRINTUSERID, ");
		sql.append("CY_PRINTNUM, ");
		sql.append("CY_PRINTUSERID, ");
		sql.append("PG_PRICE, ");
		sql.append("PG_PRINTNUM, ");
		sql.append("PG_PRINTUSERID, ");
		sql.append("DB_PRINTNUM, ");
		sql.append("DB_PRINTUSERID, ");
		sql.append("OWNERTYPE, ");
		sql.append("CAROWNER, ");
		sql.append("CAROWNERIDCARDNO, ");
		sql.append("OWNERPHONE, ");
		sql.append("OWNERADDRESS, ");
		sql.append("OWNERORGNO, ");
		sql.append("AGENTNAME, ");
		sql.append("AGENTOWNERIDCARDNO, ");
		sql.append("AGENTADDRESS, ");
		sql.append("AGENTPHONE, ");
		sql.append("NEWOWNERTYPE, ");
		sql.append("NEWCAROWNER, ");
		sql.append("NEWCAROWNERIDCARDNO, ");
		sql.append("NEWOWNERPHONE, ");
		sql.append("NEWOWNERTELPHONE, ");
		sql.append("NEWOWNERADDRESS, ");
		sql.append("NEWOWNERORGNO, ");
		sql.append("NEWOWNERZIPCODE, ");
		sql.append("NEWOWNERMAILADDRESS, ");
		sql.append("NEWAGENTNAME, ");
		sql.append("NEWAGENTOWNERIDCARDNO, ");
		sql.append("NEWAGENTADDRESS, ");
		sql.append("NEWAGENTPHONE, ");
		sql.append("OWNERSGROUPPHOTO, ");
		sql.append("MATERIALIMAGES1, ");
		sql.append("MATERIALIMAGES2, ");
		sql.append("MATERIALIMAGES3, ");
		sql.append("MATERIALIMAGES4, ");
		sql.append("MATERIALIMAGES5, ");
		sql.append("PRICE, ");
		sql.append("TRANSFERPRICE, ");
		sql.append("EXTENDEDPRICE, ");
		sql.append("DOUBLETRANSFERPRICE, ");
		sql.append("SOURCETYPE, ");
		sql.append("STATUS, ");
		sql.append("AGENTTIME, ");
		sql.append("GH_PRINTNUM, ");
		sql.append("GH_PRINTUSERID, ");
		sql.append("ZY_PRINTNUM, ");
		sql.append("ZY_PRINTUSERID, ");
		sql.append("LZ_PRINTNUM, ");
		sql.append("LZ_PRINTUSERID, ");
		sql.append("XS_PRINTNUM, ");
		sql.append("XS_PRINTUSERID, ");
		sql.append("TRANSFERTYPE, ");
		sql.append("CARMARKETIN, ");
		sql.append("MOVEOUTPROVINCE, ");
		sql.append("MOVEOUTCITY, ");
		sql.append("TAXNO, ");
		sql.append("TRANSNO, ");
		sql.append("TRANSMARKET, ");
		sql.append("PAYMENTPEOPLE, ");
		sql.append("LICENSEACCEPTIME, ");
		sql.append("GAINTYPE, ");//
		sql.append("ATTNID, ");
		sql.append("INSERTUSERID, ");
		sql.append("LC_PRINTTIME, ");
		sql.append("CY_PRINTTIME, ");
		sql.append("PG_TIME, ");
		sql.append("PG_PRINTTIME, ");
		sql.append("DB_PRINTTIME, ");
		sql.append("GH_PRINTTIME, ");
		sql.append("ZY_PRINTTIME, ");
		sql.append("LZ_PRINTTIME, ");
		sql.append("XS_PRINTTIME, ");
		sql.append("INSERTTIME, ");
		sql.append("UPDATEUSERID, ");
		sql.append("UPDATETIME, ");
		sql.append("PRETRANSFER, ");
		sql.append("CHANGETRADETICKET, ");
		sql.append("REGISTRATION, ");
		sql.append("TRANSFERREGISTER, ");
		sql.append("CHANGESVACATE, ");
		sql.append("WAITFORSTATUS, ");
		sql.append("CHECKUSERID  ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("  WHERE VIN=?  ");
		sql.append("  ORDER BY INSERTTIME ASC  ");

		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, vin);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setCarType(rs.getString("CY_CARTYPE"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
				dto.setPg_price(rs.getInt("PG_PRICE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
				dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
				dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
				dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setCarMarketIn(rs.getString("CARMARKETIN"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
				dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setInsertUserid(rs.getInt("INSERTUSERID"));
				dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
				dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
				dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
				dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
				dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
				dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setPreTransfer(rs.getInt("PRETRANSFER"));
				dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
			}
			return dto;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateLicenseBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" LICENSEPLATE=?,   ");
			sql.append(" UPDATETIME=SYSDATE() ,  ");
			sql.append(" UPDATEUSERID=?  ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getLicensePlate());
			ps.setInt(2, dto.getUpdateUserId());
			ps.setString(3, dto.getSerial());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptedInfoByLicenseplate(String serial, int marketType, String licenseplate)
			throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" BASICCARID=?,   ");
			sql.append(" MARKETTYPE=?,   ");
			sql.append(" UPDATETIME=SYSDATE() ");
			sql.append(" WHERE LICENSEPLATE =?  ");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, serial);
			ps.setInt(2, marketType);
			ps.setString(3, licenseplate);
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptInfoAtAdvance(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" VIN=?,  ");
			sql.append(" AGENTNAME=?,  ");
			sql.append(" AGENTPHONE=?,  ");
			sql.append(" AGENTOWNERIDCARDNO=?,  ");
			sql.append(" AGENTADDRESS=?,  ");
			sql.append(" MATERIALIMAGES1=?,  ");
			sql.append(" MATERIALIMAGES2=?,  ");
			sql.append(" MATERIALIMAGES3=?,  ");
			sql.append(" MATERIALIMAGES4=?,  ");
			sql.append(" MATERIALIMAGES5=?,  ");
			sql.append(" OWNERSGROUPPHOTO=?,  ");
			sql.append(" STATUS=?,  ");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" UPDATETIME=SYSDATE(),  ");
			sql.append(" AGENTTIME=SYSDATE(),  ");
			sql.append(" PRETRANSFER=?,   ");
			sql.append(" TRANSFERPRICE=?,   ");
			sql.append(" TAXNO=?,   ");
			sql.append(" WAITFORSTATUS=?,   ");
			sql.append(" MEMBERID=?,   ");
			sql.append(" OWNERTYPE=?   ");
			sql.append(" WHERE SERIAL =?  ");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getVin());
			ps.setString(2, dto.getAgentName());
			ps.setString(3, dto.getAgentPhone());
			ps.setString(4, dto.getAgentOwnerIdCardNo());
			ps.setString(5, dto.getAgentAddress());
			ps.setString(6, dto.getMaterialImages1());
			ps.setString(7, dto.getMaterialImages2());
			ps.setString(8, dto.getMaterialImages3());
			ps.setString(9, dto.getMaterialImages4());
			ps.setString(10, dto.getMaterialImages5());
			ps.setString(11, dto.getOwnersGroupPhoto());
			ps.setInt(12, dto.getStatus());
			ps.setInt(13, dto.getUpdateUserId());
			ps.setInt(14, dto.getPreTransfer());
			ps.setInt(15, dto.getTransferPrice());
			ps.setString(16, dto.getTaxNo());
			ps.setInt(17, dto.getWaitForStatus());
			ps.setString(18, dto.getMemberId());
			ps.setInt(19, dto.getOwnerType());
			ps.setString(20, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public List<TransferAcceptedInfoDto> getAcceptInfoByJYMonth(String month) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> carCheckList = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("MARKETTYPE,");
		sql.append("BASICCARID,");
		sql.append("VIN,");
		sql.append("PRICE,");
		sql.append("CARMARKETIN ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE ");
		sql.append(" DATE_FORMAT(GH_PRINTTIME,'%Y-%m') ='" + month + "' ");

		try {
			ps = conn.prepareStatement(sql.toString());

			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setVin(rs.getString("VIN"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setCarMarketIn(rs.getString("CARMARKETIN"));
				carCheckList.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
		return carCheckList;
	}

	@Override
	public void updateCfileTime(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("UPDATE  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" SET  ");
		sql.append(" CHECKFILETIME=?,  ");
		sql.append(" CHECKFILEBACKTIME=SYSDATE()  ");
		sql.append(" WHERE SERIAL =?  ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setTimestamp(1, dto.getCheckFileTime());
			ps.setString(2, dto.getSerial());

			ps.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	@Override
	public void updatePicChange(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("UPDATE  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" SET  ");
		sql.append("PICCHANGENUM=?,");
		sql.append("PICCHANGEUSERID=?,");
		sql.append("UPDATEUSERID=?,");
		sql.append("PICCHANGETIME=SYSDATE(),");
		sql.append("PHOTO_1=?,");
		sql.append("UPDATETIME=SYSDATE()");
		sql.append(" WHERE SERIAL =?  ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getPicChangeNum());
			ps.setInt(2, dto.getPicChangeUserId());
			ps.setInt(3, dto.getUpdateUserId());
			ps.setString(4, dto.getPhoto_1());
			ps.setString(5, dto.getSerial());

			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public List loadReAcceptList() throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> carCheckList = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" A.SERIAL,");
		sql.append(" A.LICENSEPLATE,");
		sql.append(" A.LICENSEPLATECOL,");
		sql.append(" A.CAROWNER,");
		sql.append(" A.CY_CARDTYPE,");
		sql.append(" A.MATERIALIMAGES1,");
		sql.append(" A.MATERIALIMAGES1,");
		sql.append(" A.MATERIALIMAGES2,");
		sql.append(" A.MATERIALIMAGES3,");
		sql.append(" A.MATERIALIMAGES4,");
		sql.append(" A.MATERIALIMAGES5,");
		sql.append(" B.CHECKPRICE,");
		sql.append(" B.CHECKPRICEDATE,");
		sql.append(" B.TRANSFERPRICEDATE,");
		sql.append(" A.TRANSFERPRICE,");
		sql.append(" A.LICENSEPLATECOL,");
		sql.append(" DATE_FORMAT(A.INSERTTIME, '%H:%I') AS INSERTTIME,");
		sql.append(" TIMESTAMPDIFF(DAY, A.INSERTTIME, SYSDATE()) AS INDS");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_TRANSFER_FINANCE_INFO + " B ON (A.SERIAL = B.SERIAL) ");
		sql.append(" WHERE ");
		sql.append(" A.STATUS in(1,2,3) AND A.PRETRANSFER = 1 AND A.CARCLASS=2 ");
		sql.append(" ORDER BY INDS ");
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setLicensePlateCol(rs.getString("LICENSEPLATECOL"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setCheckPrice(rs.getInt("CHECKPRICE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setCheckPriceDate(rs.getTimestamp("CHECKPRICEDATE"));
				dto.setTransferPriceDate(rs.getTimestamp("TRANSFERPRICEDATE"));
				dto.setInds(rs.getInt("INDS"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setLicensePlateCol(rs.getString("LICENSEPLATECOL"));
				carCheckList.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
		return carCheckList;

	}

	@Override
	public List<TransferAcceptedInfoDto> findReCar(String value,int type) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" GH_PRINTTIME, ");
		sql.append(" WAITFORSTATUS, ");
		sql.append(" LICENSEPLATE, ");
		sql.append(" transferPrice ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE ");
		sql.append(" STATUS <> 0 AND STATUS <> 16");
		if(type == 1) sql.append(" AND SERIAL=?");
		else if(type == 2) sql.append(" AND VIN=?");
		else if(type == 3) sql.append(" AND LICENSEPLATE=?");
		List<TransferAcceptedInfoDto> list = new ArrayList<TransferAcceptedInfoDto>();
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, value);
			rs = ps.executeQuery();
			while (rs.next()) {
				TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setTransferPrice(rs.getInt("transferPrice"));
				list.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
		return list;
	}

	@Override
	public boolean findTransInfobySerial(String serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		boolean flag = false;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" ID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE SERIAL=? ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, serial);
			rs = ps.executeQuery();
			while (rs.next()) {
				flag = true;
			}

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return flag;
	}

	@Override
	public TransferAcceptedInfoDto findTransfeAcceptedInfo(String licensePlate) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ID,STATUS,");
		sql.append("SERIAL ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("   WHERE LICENSEPLATE ='" + licensePlate + "' ");
		sql.append(" AND STATUS<>16 ");
		sql.append(" AND carClass=2 ");
		sql.append(" AND MARKETTYPE=2 ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setSerial(rs.getString("SERIAL"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	@Override
	public void updateTransfeAcceptedInfo(String serial, int marketType, String basicCarId, int updateUserId)
			throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("UPDATE  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" SET  ");
		sql.append("marketType=?,");
		sql.append("basicCarId=?,");
		sql.append("updateUserId=?,");
		sql.append("updateTime=SYSDATE()");
		sql.append(" WHERE serial =?  ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, marketType);
			ps.setString(2, basicCarId);
			ps.setInt(3, updateUserId);
			ps.setString(4, serial);
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateTransferDataSyn40000(TransferAcceptedInfoDto dto) throws TmsDaoException {
		int i = 1;
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("UPDATE  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" SET  ");
		if (!StringUtil.isNullOrBlank(dto.getLicensePlateCol()))
			sql.append("licensePlateCol=?,");//
		if (!StringUtil.isNullOrBlank(dto.getVin()))
			sql.append("vin=?,");
		if (dto.getPrice() != null)
			sql.append("price=?,");
		if (dto.getCardType() != null)
			sql.append("cy_cardType=?,");//
		if (!StringUtil.isNullOrBlank(dto.getCarOwner()))
			sql.append("carOwner=?,");
		if (!StringUtil.isNullOrBlank(dto.getPhoto_1()))
			sql.append("photo_1=?,");
		if (!StringUtil.isNullOrBlank(dto.getMaterialImages1()))
			sql.append("materialImages1=?,");
		if (!StringUtil.isNullOrBlank(dto.getMaterialImages2()))
			sql.append("materialImages2=?,");
		if (!StringUtil.isNullOrBlank(dto.getMaterialImages3()))
			sql.append("materialImages3=?,");
		if (!StringUtil.isNullOrBlank(dto.getMaterialImages4()))
			sql.append("materialImages4=?,");
		if (!StringUtil.isNullOrBlank(dto.getMaterialImages5()))
			sql.append("materialImages5?,");
		if (!StringUtil.isNullOrBlank(dto.getMemberId()))
			sql.append("memberId=?,");
		if (!StringUtil.isNullOrBlank(dto.getAttnId()))
			sql.append("attnId=?,");
		if (dto.getCarClass() != null)
			sql.append("carClass=?,"); //
		if (dto.getTransferPrice() > 0)
			sql.append("transferPrice=?,");
		if (dto.getStatus() != null)
			sql.append("status=?,");
		sql.append("preTransfer=1,");
		sql.append("updateUserId=1,");
		sql.append("updateTime=SYSDATE()");
		sql.append(" WHERE serial =?  ");//
		try {
			ps = conn.prepareStatement(sql.toString());
			if (!StringUtil.isNullOrBlank(dto.getLicensePlateCol()))
				ps.setInt(i++, Integer.parseInt(dto.getLicensePlateCol()));
			if (!StringUtil.isNullOrBlank(dto.getVin()))
				ps.setString(i++, dto.getVin());
			if (dto.getPrice() != null)
				ps.setInt(i++, dto.getPrice());
			if (dto.getCardType() != null)
				ps.setInt(i++, dto.getCardType());
			if (!StringUtil.isNullOrBlank(dto.getCarOwner()))
				ps.setString(i++, dto.getCarOwner());
			if (!StringUtil.isNullOrBlank(dto.getPhoto_1()))
				ps.setString(i++, dto.getPhoto_1());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages1()))
				ps.setString(i++, dto.getMaterialImages1());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages2()))
				ps.setString(i++, dto.getMaterialImages2());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages3()))
				ps.setString(i++, dto.getMaterialImages3());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages4()))
				ps.setString(i++, dto.getMaterialImages4());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages5()))
				ps.setString(i++, dto.getMaterialImages5());
			if (!StringUtil.isNullOrBlank(dto.getMemberId()))
				ps.setString(i++, dto.getMemberId());
			if (!StringUtil.isNullOrBlank(dto.getAttnId()))
				ps.setString(i++, dto.getAttnId());
			if (dto.getCarClass() != null)
				ps.setInt(i++, dto.getCarClass());
			if (dto.getTransferPrice() > 0)
				ps.setInt(i++, dto.getTransferPrice());
			if (dto.getStatus() != null)
				ps.setInt(i++, dto.getStatus());
			ps.setString(i++, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void saveTransferDataSyn40000(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			int i = 1;
			StringBuffer sql = new StringBuffer("INSERT INTO ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" (  ");
			sql.append(" serial,  ");
			if (!StringUtil.isNullOrBlank(dto.getLicensePlate()))
				sql.append("licensePlate, ");
			if (!StringUtil.isNullOrBlank(dto.getBasicCarId()))
				sql.append("basicCarId, ");
			if (dto.getMarketType() != null)
				sql.append("marketType, ");
			if (!StringUtil.isNullOrBlank(dto.getLicensePlateCol()))
				sql.append("licensePlateCol, ");
			if (!StringUtil.isNullOrBlank(dto.getVin()))
				sql.append("vin, ");
			if (dto.getPrice() != null)
				sql.append("price, ");
			if (!StringUtil.isNullOrBlank(dto.getCarOwner()))
				sql.append("carOwner, ");
			if (dto.getCardType() != null)
				sql.append("cy_cardType, ");
			if (!StringUtil.isNullOrBlank(dto.getPhoto_1()))
				sql.append("photo_1, ");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages1()))
				sql.append("materialImages1, ");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages2()))
				sql.append("materialImages2, ");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages3()))
				sql.append("materialImages3, ");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages4()))
				sql.append("materialImages4, ");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages5()))
				sql.append("materialImages5, ");
			if (!StringUtil.isNullOrBlank(dto.getMemberId()))
				sql.append("memberId, ");
			if (dto.getCarClass() != null)
				sql.append("carClass, ");
			sql.append("attnId, ");
			sql.append("status, ");
			sql.append("insertUserid, ");
			sql.append("insertTime, ");
			sql.append("updateUserId  ");
			sql.append("  ) VALUES ( ");
			sql.append(" ? ");
			if (!StringUtil.isNullOrBlank(dto.getLicensePlate()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getBasicCarId()))
				sql.append(" ,?");
			if (dto.getMarketType() != null)
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getLicensePlateCol()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getVin()))
				sql.append(" ,?");
			if (dto.getPrice() != null)
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getCarOwner()))
				sql.append(" ,?");
			if (dto.getCardType() != null)
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getPhoto_1()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages1()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages2()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages3()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages4()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages5()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getMemberId()))
				sql.append(" ,?");
			if (!StringUtil.isNullOrBlank(dto.getAttnId()))
				sql.append(" ,?");
			if (dto.getCarClass() != null)
				sql.append(" ,?");
			sql.append(" ,1");
			sql.append(" ,1");
			sql.append(" ,1");
			sql.append(" ,SYSDATE()");
			sql.append(" ,1 )");

			ps = conn.prepareStatement(sql.toString());
			ps.setString(i++, dto.getSerial());
			if (!StringUtil.isNullOrBlank(dto.getLicensePlate()))
				ps.setString(i++, dto.getLicensePlate());
			if (!StringUtil.isNullOrBlank(dto.getBasicCarId()))
				ps.setString(i++, dto.getBasicCarId());
			if (dto.getMarketType() != null)
				ps.setInt(i++, dto.getMarketType());
			if (!StringUtil.isNullOrBlank(dto.getLicensePlateCol()))
				ps.setInt(i++, Integer.parseInt(dto.getLicensePlateCol()));
			if (!StringUtil.isNullOrBlank(dto.getVin()))
				ps.setString(i++, dto.getVin());
			if (dto.getPrice() != null)
				ps.setInt(i++, dto.getPrice());
			if (!StringUtil.isNullOrBlank(dto.getCarOwner()))
				ps.setString(i++, dto.getCarOwner());
			if (dto.getCardType() != null)
				ps.setInt(i++, dto.getCardType());
			if (!StringUtil.isNullOrBlank(dto.getPhoto_1()))
				ps.setString(i++, dto.getPhoto_1());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages1()))
				ps.setString(i++, dto.getMaterialImages1());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages2()))
				ps.setString(i++, dto.getMaterialImages2());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages3()))
				ps.setString(i++, dto.getMaterialImages3());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages4()))
				ps.setString(i++, dto.getMaterialImages4());
			if (!StringUtil.isNullOrBlank(dto.getMaterialImages5()))
				ps.setString(i++, dto.getMaterialImages5());
			if (!StringUtil.isNullOrBlank(dto.getMemberId()))
				ps.setString(i++, dto.getMemberId());
			if (!StringUtil.isNullOrBlank(dto.getAttnId()))
				ps.setString(i++, dto.getAttnId());
			if (dto.getCarClass() != null)
				ps.setInt(i++, dto.getCarClass());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	public boolean isExistTransferInfoByBasicCarId(String basicCarId) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		boolean flag = false;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" ID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE ");
		sql.append(" BASICCARID=? ");
		sql.append(" AND STATUS <> 16 ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, basicCarId);
			rs = ps.executeQuery();
			while (rs.next()) {
				flag = true;
			}

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return flag;
	}

	public boolean isExistTransferInfoByLicensePlate(String licensePlate) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		boolean flag = false;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" ID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE ");
		sql.append(" LICENSEPLATE=? ");
		sql.append(" AND STATUS <> 16 ");
		sql.append(" AND CARCLASS = 2 ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, licensePlate);
			rs = ps.executeQuery();
			while (rs.next()) {
				flag = true;
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return flag;
	}

	public boolean isExistTransferInfoByVin(String vin) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		boolean flag = false;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" ID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE ");
		sql.append(" VIN=? ");
		sql.append(" AND STATUS <> 16 ");
		sql.append(" AND CARCLASS = 1 ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, vin);
			rs = ps.executeQuery();
			while (rs.next()) {
				flag = true;
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return flag;
	}

	public void insertCarTranserAcceptInfo(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("INSERT INTO ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" (  ");
		sql.append(" SERIAL,  ");
		sql.append(" MARKETTYPE,  ");
		sql.append(" LICENSEPLATE,  ");
		sql.append(" CY_CARDTYPE,");
		sql.append(" CARCLASS, ");
		sql.append(" LICENSEPLATECOL, ");
		sql.append(" TRANSFERPRICE, ");
		sql.append(" STATUS,  ");
		sql.append(" SOURCETYPE,  ");
		sql.append(" INSERTUSERID,  ");
		sql.append(" UPDATEUSERID,  ");
		sql.append(" BASICCARID,  ");
		sql.append(" VIN,  ");
		sql.append(" VENDORID,  ");
		sql.append(" BRANDID,  ");
		sql.append(" CARSTYLEID,  ");
		sql.append(" CARNAME,  ");
		sql.append(" ISMATCH,  ");
		sql.append(" PHOTO_1,  ");
		sql.append(" MEMBERID,  ");
		sql.append(" INSERTTIME,  ");
		sql.append(" UPDATETIME, ");
		sql.append(" PRETRANSFER, ");
		sql.append(" CY_PRINTNUM, ");
		sql.append(" CY_PRINTUSERID ");
		// sql.append(" CY_PRINTTIME ");
		sql.append("  ) VALUES ( ");
		sql.append("?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,SYSDATE(),SYSDATE(),?,?,?)");

		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getSerial());
			ps.setInt(2, dto.getMarketType());
			ps.setString(3, dto.getLicensePlate());
			ps.setInt(4, dto.getCardType());
			ps.setInt(5, dto.getCarClass());
			ps.setString(6, dto.getLicensePlateCol());
			ps.setInt(7, dto.getTransferPrice());
			ps.setInt(8, dto.getStatus());
			ps.setInt(9, dto.getSourceType());
			ps.setInt(10, dto.getInsertUserid());
			ps.setInt(11, dto.getUpdateUserId());
			ps.setString(12, dto.getBasicCarId());
			ps.setString(13, dto.getVin());
			ps.setString(14, dto.getVendorId());
			ps.setString(15, dto.getBrandId());
			ps.setString(16, dto.getCarStyleId());
			ps.setString(17, dto.getCarName());
			ps.setInt(18, dto.getIsMatch());
			ps.setString(19, dto.getPhoto_1());
			ps.setString(20, dto.getMemberId());
			ps.setInt(21, dto.getPreTransfer());
			ps.setInt(22, dto.getCy_printNum());
			ps.setInt(23, dto.getCy_printUserId());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public TransferAcceptedInfoDto selectNumbesByLicensePlateOrVin(TransferAcceptedInfoDto transferAcceptedInfoDto)
			throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT CHECKUSERID,STATUS,SERIAL  FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE 1=1 ");

		if (!StringUtil.isNullOrBlank(transferAcceptedInfoDto.getLicensePlate())) {
			sql.append(" AND LICENSEPLATE= ? ");
			sql.append(" AND CARCLASS = 2 ");
			sql.append(" AND STATUS NOT IN (0,16)");
		} else if (!StringUtil.isNullOrBlank(transferAcceptedInfoDto.getVin())) {
			sql.append(" AND VIN= ? ");
			sql.append(" AND CARCLASS = 1 ");
			sql.append(" AND STATUS NOT IN (0,16)");
		}
		try {
			ps = conn.prepareStatement(sql.toString());

			int i = 1;
			if (!StringUtil.isNullOrBlank(transferAcceptedInfoDto.getLicensePlate())) {
				ps.setString(i++, transferAcceptedInfoDto.getLicensePlate());

			} else if (!StringUtil.isNullOrBlank(transferAcceptedInfoDto.getVin())) {
				ps.setString(i++, transferAcceptedInfoDto.getVin());
			}
			rs = ps.executeQuery();
			TransferAcceptedInfoDto entity = null;
			while (rs.next()) {
				entity = new TransferAcceptedInfoDto();
				entity.setCheckUserid(rs.getInt("CHECKUSERID"));
				entity.setStatus(rs.getInt("STATUS"));
				entity.setSerial(rs.getString("SERIAL"));
			}
			return entity;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePicChangeNumWhenNull(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" PICCHANGENUM=0 			");
			sql.append(" WHERE SERIAL = ?  AND PICCHANGENUM IS NULL	");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updatePhoto1BySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" PICCHANGENUM=PICCHANGENUM+1,  			");
			sql.append(" PICCHANGETIME=NOW(),  	");
			sql.append(" PICCHANGEUSERID=1,  		");
			sql.append(" PHOTO_1=? ");
			sql.append(" WHERE SERIAL = ?  AND PICCHANGENUM IS NOT NULL	");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(1, dto.getPhoto_1());
			ps.setString(2, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void insertCarInfoAtWX(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;

		try {
			StringBuffer sql = new StringBuffer("INSERT INTO ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" (  ");
			sql.append(" SERIAL,  ");
			sql.append(" MARKETTYPE,  ");
			if (dto.getLicensePlate() != null && !dto.getLicensePlate().isEmpty()) {
				sql.append(" LICENSEPLATE,  ");
			} else if (dto.getVin() != null && !dto.getVin().isEmpty()) {
				sql.append(" VIN,  ");
			}

			sql.append(" CY_CARDTYPE,  ");
			sql.append(" CARCLASS,  ");
			sql.append(" PHOTO_1,  ");
			sql.append(" LICENSEPLATECOL,  ");
			sql.append(" STATUS,  ");
			sql.append(" INSERTUSERID,  ");
			sql.append(" UPDATEUSERID,  ");
			sql.append(" VINNUM,  ");
			sql.append(" ENGINENUM,  ");
			sql.append(" BRANDMODEL,  ");
			sql.append(" PLATEORTIREEXTERIOR,  ");
			sql.append(" TIREINTACT,  ");
			sql.append(" SEATBELT,  ");
			sql.append(" INSERTTIME,  ");
			sql.append(" UPDATETIME,  ");
			sql.append(" transferPrice  ");
			sql.append("  ) VALUES ( ");
			sql.append(" ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,SYSDATE(),SYSDATE(),2)");

			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getSerial());
			ps.setInt(2, dto.getMarketType());
			if (dto.getLicensePlate() != null && !dto.getLicensePlate().isEmpty()) {
				ps.setString(3, dto.getLicensePlate());
			} else if (dto.getVin() != null && !dto.getVin().isEmpty()) {
				ps.setString(3, dto.getVin());
			}
			ps.setInt(4, dto.getCardType());
			ps.setInt(5, dto.getCarClass());
			ps.setString(6, dto.getPhoto_1());
			ps.setString(7, dto.getLicensePlateCol());
			ps.setInt(8, dto.getStatus());
			ps.setInt(9, dto.getInsertUserid());
			ps.setInt(10, dto.getUpdateUserId());
			ps.setString(11, dto.getVinNum());
			ps.setString(12, dto.getEngineNum());
			ps.setString(13, dto.getBrandModel());
			ps.setString(14, dto.getPlateOrTireExterior());
			ps.setString(15, dto.getTireIntact());
			ps.setString(16, dto.getSeatBelt());

			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}

	}

	@Override
	public void updateBasicCarIdBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" BASICCARID=? ");
			sql.append(" WHERE SERIAL = ?");

			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getBasicCarId());
			ps.setString(2, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptedInfoBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		// TODO Auto-generated method stub

		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" MARKETTYPE=?,");
			sql.append(" BASICCARID=?,");
			sql.append(" VIN = ?,");
			sql.append(" VENDORID=?,");
			sql.append(" BRANDID=?,");
			sql.append(" CARSTYLEID=?,");
			sql.append(" CARNAME=?,");
			sql.append(" ISMATCH=?,");
			/* sql.append("PHOTO_1=?, "); */
			sql.append(" TRANSFERPRICE=?,");
			sql.append(" MEMBERID=?");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());

			ps.setInt(1, dto.getMarketType());
			ps.setString(2, dto.getBasicCarId());
			ps.setString(3, dto.getVin());
			ps.setString(4, dto.getVendorId());
			ps.setString(5, dto.getBrandId());
			ps.setString(6, dto.getCarStyleId());
			ps.setString(7, dto.getCarName());
			ps.setInt(8, dto.getIsMatch());
			/* ps.setString(i++, dto.getPhoto_1()); */
			if (dto.getTransferPrice() != 0) {
				ps.setInt(9, dto.getTransferPrice());
			} else {
				ps.setInt(9, 0);
			}
			ps.setString(10, dto.getMemberId());
			ps.setString(11, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptedInfoBySerialNewCar(TransferAcceptedInfoDto dto) throws TmsDaoException {
		// TODO Auto-generated method stub

		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" MARKETTYPE=?,");
			sql.append(" BASICCARID=?,  ");
			sql.append(" VIN = ?,");
			sql.append(" VENDORID=?,");
			sql.append(" BRANDID=?,");
			sql.append(" CARSTYLEID=?,");
			sql.append(" CARNAME=?,");
			sql.append(" ISMATCH=?,");
			/* sql.append("PHOTO_1=?, "); */
			sql.append(" MEMBERID=? ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			/* int i = 1; */
			ps.setInt(1, dto.getMarketType());
			ps.setString(2, dto.getBasicCarId());
			ps.setString(3, dto.getVin());
			ps.setString(4, dto.getVendorId());
			ps.setString(5, dto.getBrandId());
			ps.setString(6, dto.getCarStyleId());
			ps.setString(7, dto.getCarName());
			ps.setInt(8, dto.getIsMatch());
			/* ps.setString(i++, dto.getPhoto_1()); */
			ps.setString(9, dto.getMemberId());
			ps.setString(10, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public TransferAcceptedInfoDto findTransfeAcceptedInfoBy401(String serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("SERIAL, ");
		sql.append("MARKETTYPE, ");
		sql.append("LICENSEPLATE, ");
		sql.append("CY_CARDTYPE, ");
		sql.append("CARCLASS, ");
		sql.append("LICENSEPLATECOL, ");
		sql.append("BASICCARID, ");
		sql.append("VIN, ");
		sql.append("VENDORID, ");
		sql.append("BRANDID, ");
		sql.append("CARSTYLEID, ");
		sql.append("CARNAME, ");
		sql.append("ISMATCH ,");
		sql.append("PHOTO_1, ");
		sql.append("MEMBERID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE SERIAL = ?");

		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, serial);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));

				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setLicensePlateCol(rs.getString("LICENSEPLATECOL"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setVin(rs.getString("VIN"));
				dto.setVendorId(rs.getString("VENDORID"));
				dto.setBrandId(rs.getString("BRANDID"));
				dto.setCarStyleId(rs.getString("CARSTYLEID"));
				dto.setCarName(rs.getString("CARNAME"));
				dto.setIsMatch(rs.getInt("ISMATCH"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setMemberId(rs.getString("MEMBERID"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	public void updateTransfeAcceptedInfoBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("UPDATE  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" SET  ");
		sql.append(" MARKETTYPE=?, ");
		sql.append(" BASICCARID=?, ");
		sql.append(" MEMBERID=?, ");
		sql.append(" UPDATEUSERID=?, ");
		sql.append(" UPDATETIME=SYSDATE() ");
		sql.append(" WHERE ");
		sql.append(" SERIAL=? ");
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getMarketType());
			ps.setString(2, dto.getBasicCarId());
			ps.setString(3, dto.getMemberId());
			ps.setInt(4, dto.getUpdateUserId());
			ps.setString(5, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * 根据流水号查询过户业务基本信息
	 */
	@Override
	public TransferAcceptedInfoDto findTransferAcceptedInfoBySerial(String serial) throws TmsDaoException {

		PreparedStatement ps = null;
		ResultSet rs = null;
		TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();

		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("SERIAL, ");
			sql.append("MARKETTYPE, ");
			sql.append("BASICCARID, ");
			sql.append("LICENSEPLATE, ");
			sql.append("VIN, ");
			sql.append("CY_CARDTYPE, ");
			sql.append("CARCLASS, ");
			sql.append("MEMBERID, ");
			sql.append("NEWLICENSEPLATE, ");
			sql.append("VENDORID, ");
			sql.append("BRANDID, ");
			sql.append("CARSTYLEID, ");
			sql.append("CARNAME, ");
			sql.append("PRICE, ");
			sql.append("ISMATCH ");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, serial);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setMemberId(rs.getString("MEMBERID"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setVendorId(rs.getString("VENDORID"));
				dto.setBrandId(rs.getString("BRANDID"));
				dto.setCarStyleId(rs.getString("CARSTYLEID"));
				dto.setCarName(rs.getString("CARNAME"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setIsMatch(rs.getInt("ISMATCH"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	@Override
	public TransferAcceptedInfoDto getTransferAcceptedInfoByLicenseplate(String licenseplate) throws TmsDaoException {
		if (StringUtil.isNullOrBlank(licenseplate)) return null;
		String param1 = licenseplate.substring(2);
		String param2 = licenseplate.substring(1);
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("SERIAL, ");
		sql.append("MARKETTYPE, ");
		sql.append("LICENSEPLATE, ");
		sql.append("CY_CARDTYPE, ");
		sql.append("CARCLASS, ");
		sql.append("LICENSEPLATECOL, ");
		sql.append("BASICCARID, ");
		sql.append("VIN, ");
		sql.append("VENDORID, ");
		sql.append("BRANDID, ");
		sql.append("CARSTYLEID, ");
		sql.append("CARNAME, ");
		sql.append("ISMATCH ,");
		sql.append("STATUS,    ");
		sql.append("PHOTO_1, ");
		sql.append("UPDATETIME, ");
		sql.append("INSERTTIME, ");
		sql.append("MEMBERID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE LICENSEPLATE LIKE ? OR LICENSEPLATE LIKE ? ORDER BY UPDATETIME DESC LIMIT 1");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, "%" + param1 + "%");
			ps.setString(2, "%" + param2 + "%");
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setLicensePlateCol(rs.getString("LICENSEPLATECOL"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setVin(rs.getString("VIN"));
				dto.setVendorId(rs.getString("VENDORID"));
				dto.setBrandId(rs.getString("BRANDID"));
				dto.setCarStyleId(rs.getString("CARSTYLEID"));
				dto.setCarName(rs.getString("CARNAME"));
				dto.setIsMatch(rs.getInt("ISMATCH"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setMemberId(rs.getString("MEMBERID"));
				dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	@Override
	public TransferAcceptedInfoDto findTransferInfoByBasicCarId(String basicCarId) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" SERIAL, ");
		sql.append(" VIN, ");
		sql.append(" LICENSEPLATE, ");
		sql.append(" CARCLASS, ");
		sql.append(" CY_CARDTYPE, ");
		sql.append(" LC_PRINTNUM, ");
		sql.append(" CY_PRINTNUM, ");
		sql.append(" CAROWNER, ");
		sql.append(" STATUS ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE ");
		sql.append(" BASICCARID =" + basicCarId);

		TransferAcceptedInfoDto dto = null;
		try {
			int i = 1;
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				if (i > 1) {
					break;
				}
				dto = new TransferAcceptedInfoDto();
				dto.setSerial(rs.getString("SERIAL"));
				dto.setVin(rs.getString("VIN"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setStatus(rs.getInt("STATUS"));
				i++;
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	public void updateTransferAcceptedLCByBasicCarId(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" CAROWNER=?,");
			sql.append(" LC_PRINTNUM=?,");
			sql.append(" LC_PRINTTIME=SYSDATE(),");
			sql.append(" CY_PRINTTIME=SYSDATE(),");
			sql.append(" LC_PRINTUSERID=?,");
			sql.append(" STATUS=?,");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" UPDATETIME=SYSDATE() ");
			sql.append(" WHERE ");
			sql.append(" BASICCARID=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, dto.getCarOwner());
			ps.setInt(2, dto.getLc_printNum());
			ps.setInt(3, dto.getLc_printUserId());
			ps.setInt(4, dto.getStatus());
			ps.setInt(5, dto.getUpdateUserId());
			ps.setString(6, dto.getBasicCarId());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	/**
	 * 根据流水号查询打印次数（流程表和查验表）
	 */
	@Override
	public TransferAcceptedInfoDto findPrintNumInfoByBasicCarId(String basicCarId) throws TmsDaoException {

		PreparedStatement ps = null;
		ResultSet rs = null;
		TransferAcceptedInfoDto dto = new TransferAcceptedInfoDto();

		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("LC_PRINTNUM,");
			sql.append("CY_PRINTNUM,");
			sql.append("LICENSEPLATE,");
			sql.append("VIN,");
			sql.append("CAROWNER,");
			sql.append("TRANSFER,");
			sql.append("CHANGEUSENATURE,");
			sql.append("REPEATVIN,");
			sql.append("REPEATENGINENUM,");
			sql.append("CHANGEALLCAR,");
			sql.append("APPLYCERTIFICATE,");
			sql.append("REPLACEMENTCERTIFICATE,");
			sql.append("MONITORINGSALES,");
			sql.append("OTHER,");
			sql.append("VINNUM,");
			sql.append("ENGINENUM,");
			sql.append("BRANDMODEL,");
			sql.append("CY_COLOR,");
			sql.append("CY_PASSENGER,");
			sql.append("CY_CARTYPE,");
			sql.append("PLATEORTIREEXTERIOR,");
			sql.append("TIREINTACT,");
			sql.append("SEATBELT,");
			sql.append("NUMBERAXES,");
			sql.append("TIRESIZE,");
			sql.append("LATERALPORTIONOF,");
			sql.append("REFLECTIVEMARK,");
			sql.append("FIREEXTINGUISHER,");
			sql.append("DRIVINGRECORD,");
			sql.append("SECURITY,");
			sql.append("EXTERNALMARKING,");
			sql.append("SIREN,");
			sql.append("SECURITYTECHNOLOGY,");
			sql.append("CHECKCONCLUSION,");
			sql.append("PHOTO_1,");
			sql.append("PHOTO_2,");
			sql.append("PHOTO_3,");
			sql.append("PHOTO_4,");
			sql.append("REMARK,");
			sql.append("CY_CARDTYPE,");
			sql.append("SERIAL, ");
			sql.append("MARKETTYPE, ");
			sql.append("PG_PRINTNUM, ");
			sql.append("DB_PRINTNUM, ");
			sql.append("ZY_PRINTNUM, ");
			sql.append("ZY_PRINTTIME, ");
			sql.append("ZY_PRINTUSERID, ");
			sql.append("GH_PRINTNUM, ");
			sql.append("GH_PRINTTIME, ");
			sql.append("GH_PRINTUSERID, ");
			sql.append("XS_PRINTNUM, ");
			sql.append("XS_PRINTUSERID, ");
			sql.append("XS_PRINTTIME, ");
			sql.append("REGISTRATION, ");
			sql.append("TRANSFERREGISTER, ");
			sql.append("CHANGESVACATE, ");
			sql.append("STATUS, ");
			sql.append("NEWLICENSEPLATE, ");
			sql.append("REAPPLYCERT, ");
			sql.append("ATTACHMEMBERID, ");
			sql.append("CARCLASS ");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" WHERE ");
			sql.append(" BASICCARID=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setString(1, basicCarId);
			rs = ps.executeQuery();
			while (rs.next()) {
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setCarType(rs.getString("CY_CARTYPE"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setReapplyCert(rs.getInt("REAPPLYCERT"));
				dto.setAttachMemberId(rs.getString("ATTACHMEMBERID"));
				dto.setCarClass(rs.getInt("CARCLASS"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	/**
	 * 
	 * 根据VIN码查询过户信息
	 */
	@Override
	public List<TransferAcceptedInfoDto> findTransferAssessInfoByVin(String vin) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> list = new ArrayList<TransferAcceptedInfoDto>();
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" SERIAL, ");
		sql.append(" INSERTTIME, ");
		sql.append(" VIN ");
		sql.append(" FROM  ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE VIN='" + vin + "' ORDER BY INSERTTIME DESC  ");

		TransferAcceptedInfoDto carDto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				carDto = new TransferAcceptedInfoDto();
				carDto.setSerial(rs.getString("SERIAL"));
				carDto.setInsertTime(rs.getTimestamp("INSERTTIME"));
				carDto.setVin(rs.getString("VIN"));
				list.add(carDto);
			}
			return list;

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public List<String> findSerialList(String serial,int type) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<String> list = new ArrayList<String>();

		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("ID, ");
		sql.append("SERIAL ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE SERIAL like '%");
		sql.append(serial);
		sql.append("%'");
		if(type == 1){
			sql.append(" AND STATUS <> 0");
			sql.append(" AND STATUS <> 16");
		}
		sql.append(" ORDER BY SERIAL ASC LIMIT 30");

		String s = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				list.add(rs.getString("SERIAL"));
			}
			return list;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}
	
	@Override
	public List<String> findListBySerial(String[] serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<String> list = new ArrayList<String>();

		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("ID, ");
		sql.append("SERIAL, ");
		sql.append("TRANSFERTYPE, ");
		sql.append("MATERIALIMAGES1, ");
		sql.append("MATERIALIMAGES2, ");
		sql.append("MATERIALIMAGES3, ");
		sql.append("MATERIALIMAGES4, ");
		sql.append("MATERIALIMAGES5, ");
		sql.append("MATERIALIMAGES6, ");
		sql.append("MATERIALIMAGES7, ");
		sql.append("MATERIALIMAGES8, ");
		sql.append("MATERIALIMAGES9, ");
		sql.append("MATERIALIMAGES10 ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE");
		sql.append("  STATUS NOT IN (0,10,11,12,16)");
		sql.append(" AND TRANSFERREGISTER = 2");

		if (serial != null && serial.length > 0) {
			sql.append(" AND (");
			for (int i = 0; i < serial.length; i++) {
				if (i > 0) sql.append(" OR ");
				sql.append(" SERIAL like '%");
				sql.append(serial[i]);
				sql.append("'");
			}
			sql.append(" )");
		}
		
		sql.append(" ORDER BY INSERTTIME ASC");

		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				if (rs.getInt("TRANSFERTYPE") == 2
						|| rs.getInt("TRANSFERTYPE") == 3
						|| rs.getInt("TRANSFERTYPE") == 5) {
					
					if (!StringUtil.isNullOrBlank(rs.getString("MATERIALIMAGES1"))
							&& !StringUtil.isNullOrBlank(rs.getString("MATERIALIMAGES2"))
							&& !StringUtil.isNullOrBlank(rs.getString("MATERIALIMAGES3"))
							&& !StringUtil.isNullOrBlank(rs.getString("MATERIALIMAGES4"))
							&& !StringUtil.isNullOrBlank(rs.getString("MATERIALIMAGES6"))) {
						
						list.add(rs.getString("SERIAL"));
					}
					
				}
				
				if (rs.getInt("TRANSFERTYPE") == 1
						|| rs.getInt("TRANSFERTYPE") == 4) {
					
					if (!StringUtil.isNullOrBlank(rs.getString("MATERIALIMAGES6"))) {
						
						list.add(rs.getString("SERIAL"));
					}
				}
			}
			return list;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public List<TransferAcceptedInfoDto> findListBySerial(String serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<TransferAcceptedInfoDto> list = new ArrayList<TransferAcceptedInfoDto>();

		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("A.ID, ");
		sql.append("A.SERIAL, ");
		sql.append("A.LICENSEPLATE, ");
		sql.append("A.VIN, ");
		sql.append("A.MEMBERID, ");
		sql.append("A.STATUS, ");
		sql.append("A.TRANSFERTYPE, ");
		sql.append("A.MATERIALIMAGES1, ");
		sql.append("A.MATERIALIMAGES2, ");
		sql.append("A.MATERIALIMAGES3, ");
		sql.append("A.MATERIALIMAGES4, ");
		sql.append("A.MATERIALIMAGES5, ");
		sql.append("A.MATERIALIMAGES6, ");
		sql.append("A.MATERIALIMAGES7, ");
		sql.append("A.MATERIALIMAGES8, ");
		sql.append("A.MATERIALIMAGES9, ");
		sql.append("A.MATERIALIMAGES10, ");
		sql.append("A.CARMARKETINPROV, ");
		sql.append("A.CARMARKETINCITY, ");
		sql.append("A.TRANSFERREGISTER, ");
		sql.append("A.CAROWNER, ");
		sql.append("A.CAROWNERIDCARDNO, ");
		sql.append("A.OWNERPHONE, ");
		sql.append("A.OWNERADDRESS, ");
		sql.append("A.AGENTNAME, ");
		sql.append("A.AGENTOWNERIDCARDNO, ");
		sql.append("A.AGENTADDRESS, ");
		sql.append("A.AGENTPHONE, ");
		sql.append("A.OWNERTYPE, ");
		sql.append("A.OWNERORGNO, ");
		sql.append("A.CHANGEBODY, ");
		sql.append("B.PRONAME, ");
		sql.append("B.CITYNAME, ");
		sql.append("A.EPSTANDARD, ");
		sql.append("A.CARREPLACETYPE, ");
		sql.append("A.CARPECCANCY, ");
		sql.append("A.OVERDUE, ");
		sql.append("A.MORTGAGE, ");
		sql.append("A.SEALUP, ");
		sql.append("A.REGISTRATION, ");
		sql.append("A.DRIVINGLICENSE, ");
		sql.append("A.SCRAPOVERDUE, ");
		sql.append("A.ROBBERY, ");
		sql.append("A.OWNERESCAPING, ");
		sql.append("A.OWNERSCRAP, ");
		sql.append("A.OWNERLIVE, ");
		sql.append("A.OWNERREMARK, ");
		sql.append("A.NEWESCAPING, ");
		sql.append("A.NEWSCRAP, ");
		sql.append("A.NEWLIVE, ");
		sql.append("A.ATTNID, ");
		sql.append("B.SHIFTTOLEVEL, ");
		sql.append(" A.cy_printTime, ");
		sql.append(" A.vendorCode, ");
		sql.append(" A.modelCode, ");
		sql.append(" A.carType, ");
		sql.append(" A.countryStyle , ");
		sql.append(" A.carUse, ");
		sql.append(" A.cardType, ");
		sql.append(" A.registerCardNo , ");
		sql.append(" A.regDate, ");
		sql.append(" A.gainType , ");
		sql.append(" A.price, ");
		sql.append(" A.newCarOwner, ");
		sql.append(" A.newOwnerPhone, ");
		sql.append(" A.newOwnerAddress, ");
		sql.append(" A.newAgentOwnerIdCardNo, ");
		sql.append(" A.newAgentName, ");
		sql.append(" A.newAgentPhone, ");
		sql.append(" A.newAgentAddress, ");
		sql.append(" A.newCarOwnerIdCardNo, ");
		sql.append(" A.newOwnerOrgNo, ");
		sql.append(" A.newOwnerZipCode, ");
		sql.append(" A.newOwnerType ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_CITY + " B ON (A.CARMARKETINPROV = B.PROVINCEID AND A.CARMARKETINCITY = B.CITYID) ");
		sql.append(" WHERE SERIAL = ");
		sql.append(serial);
		sql.append(" AND STATUS <> 0");
		sql.append(" AND STATUS <> 16");
		sql.append(" ORDER BY INSERTTIME ASC ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setMemberId(rs.getString("MEMBERID"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setMaterialImages6(rs.getString("MATERIALIMAGES6"));
				dto.setMaterialImages7(rs.getString("MATERIALIMAGES7"));
				dto.setMaterialImages8(rs.getString("MATERIALIMAGES8"));
				dto.setMaterialImages9(rs.getString("MATERIALIMAGES9"));
				dto.setMaterialImages10(rs.getString("MATERIALIMAGES10"));
				dto.setCarMarketInProv(rs.getInt("CARMARKETINPROV"));
				dto.setCarMarketInCity(rs.getInt("CARMARKETINCITY"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setShiftToLevel(rs.getString("SHIFTTOLEVEL"));
				dto.setProName(rs.getString("PRONAME"));
				dto.setCityName(rs.getString("CITYNAME"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
				dto.setChangeBody(rs.getInt("CHANGEBODY"));
				dto.setEpStandard(rs.getInt("EPSTANDARD"));
				dto.setCarReplaceType(rs.getInt("CARREPLACETYPE"));
				dto.setCarPeccancy(rs.getInt("CARPECCANCY"));
				dto.setOverdue(rs.getInt("OVERDUE"));
				dto.setMortgage(rs.getInt("MORTGAGE"));
				dto.setSealup(rs.getInt("SEALUP"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setDrivingLicense(rs.getInt("DRIVINGLICENSE"));
				dto.setScrapOverdue(rs.getInt("SCRAPOVERDUE"));
				dto.setRobbery(rs.getInt("ROBBERY"));
				dto.setOwnerEscaping(rs.getInt("OWNERESCAPING"));
				dto.setOwnerScrap(rs.getInt("OWNERSCRAP"));
				dto.setNewEscaping(rs.getInt("NEWESCAPING"));
				dto.setNewScrap(rs.getInt("NEWSCRAP"));
				dto.setNewLive(rs.getInt("NEWLIVE"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setCy_printTime(rs.getTimestamp("cy_printTime"));
				dto.setVendorCode(rs.getString("vendorCode"));
				dto.setModelCode(rs.getString("modelCode"));
				dto.setCarType(rs.getString("carType"));
				dto.setCountryStyle (rs.getString("countryStyle"));
				dto.setCarUse(rs.getString("carUse"));
				dto.setCardType(rs.getInt("cardType"));
				dto.setRegisterCardNo (rs.getString("registerCardNo"));
				dto.setRegDate(rs.getTimestamp("regDate"));
				dto.setGainType (rs.getInt("gainType"));
				dto.setPrice(rs.getInt("price"));
				dto.setNewcarOwner(rs.getString("newCarOwner"));
				dto.setNewOwnerPhone(rs.getString("newOwnerPhone"));
				dto.setNewOwnerAddress(rs.getString("newOwnerAddress"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("newAgentOwnerIdCardNo"));
				dto.setNewAgentName(rs.getString("newAgentName"));
				dto.setNewAgentPhone(rs.getString("newAgentPhone"));
				dto.setNewAgentAddress(rs.getString("newAgentAddress"));
				dto.setNewcarOwnerIdCardNo(rs.getString("newCarOwnerIdCardNo"));
				dto.setNewOwnerOrgNo(rs.getString("newOwnerOrgNo"));
				dto.setNewOwnerZipCode(rs.getString("newOwnerZipCode"));				
				dto.setNewOwnerType(rs.getInt("newOwnerType"));				
				list.add(dto);
			}
			return list;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}
	
	@Override
	public void updatePublicSecurityAuditBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		int i = 1;
		
		StringBuffer sql = new StringBuffer("UPDATE ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" SET  ");
		sql.append(" TRANSFERREGISTER=?,");//公安审核
		if (dto.getEpStandard() != 0) sql.append(" EPSTANDARD=?,");//环保达标
		if (dto.getCarReplaceType() != 0) sql.append(" CARREPLACETYPE=?,");//客车换型
		if (dto.getCarPeccancy() != 0) sql.append(" CARPECCANCY=?,");//车辆违章
		if (dto.getOverdue() != 0) sql.append(" OVERDUE=?,");//超检审核
		if (dto.getMortgage() != 0) sql.append(" MORTGAGE=?,");//抵押审核
		if (dto.getSealup() != 0) sql.append(" SEALUP=?,");//查封审核
		if (dto.getRegistration() != 0) sql.append(" REGISTRATION=?,");//登记证书
		if (dto.getDrivingLicense() != 0) sql.append(" DRIVINGLICENSE=?,");//行驶证
		if (dto.getScrapOverdue() != 0) sql.append(" SCRAPOVERDUE=?,");//报废超期
		if (dto.getRobbery() != 0) sql.append(" ROBBERY=?,");//盗抢审核
		if (dto.getOwnerEscaping() != 0) sql.append(" OWNERESCAPING=?,");//原车主在逃
		if (dto.getOwnerScrap() != 0) sql.append(" OWNERSCRAP=?,");//原车主报废车
		if (dto.getNewEscaping() != 0) sql.append(" NEWESCAPING=?,");//新车主在逃
		if (dto.getNewScrap() != 0) sql.append(" NEWSCRAP=?,");//新车主报废车
		if (dto.getNewLive() != 0) sql.append(" NEWLIVE=?,");//新车主居住证
		if (dto.getStatus() != 0) sql.append(" STATUS=?,");//状态
		sql.append(" UPDATEUSERID=?,  ");
		sql.append(" UPDATETIME=SYSDATE() ");
		sql.append(" WHERE SERIAL =?");
		sql.append(" AND STATUS <> 0");
		sql.append(" AND STATUS <> 16");
		
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(i++, dto.getTransferRegister());
			if (dto.getEpStandard() != 0) ps.setInt(i++, dto.getEpStandard());
			if (dto.getCarReplaceType() != 0) ps.setInt(i++, dto.getCarReplaceType());
			if (dto.getCarPeccancy() != 0) ps.setInt(i++, dto.getCarPeccancy());
			if (dto.getOverdue() != 0) ps.setInt(i++, dto.getOverdue());
			if (dto.getMortgage() != 0) ps.setInt(i++, dto.getMortgage());
			if (dto.getSealup() != 0) ps.setInt(i++, dto.getSealup());
			if (dto.getRegistration() != 0) ps.setInt(i++, dto.getRegistration());
			if (dto.getDrivingLicense() != 0) ps.setInt(i++, dto.getDrivingLicense());
			if (dto.getScrapOverdue() != 0) ps.setInt(i++, dto.getScrapOverdue());
			if (dto.getRobbery() != 0) ps.setInt(i++, dto.getRobbery());
			if (dto.getOwnerEscaping() != 0) ps.setInt(i++, dto.getOwnerEscaping());
			if (dto.getOwnerScrap() != 0) ps.setInt(i++, dto.getOwnerScrap());
			if (dto.getNewEscaping() != 0) ps.setInt(i++, dto.getNewEscaping());
			if (dto.getNewScrap() != 0) ps.setInt(i++, dto.getNewScrap());
			if (dto.getNewLive() != 0) ps.setInt(i++, dto.getNewLive());
			if (dto.getStatus() != 0) ps.setInt(i++, dto.getStatus());
			ps.setInt(i++, dto.getUpdateUserId());
			ps.setString(i++, dto.getSerial());
			ps.executeUpdate();
			
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}
	
	@Override
	public void updateCarOwnerAuditBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		int i = 1;
		
		StringBuffer sql = new StringBuffer("UPDATE ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" SET  ");
		sql.append(" TRANSFER=?,");//车主审核
		if(dto.getStatus() != 0) sql.append(" STATUS=?,");
		sql.append(" UPDATEUSERID=?,  ");
		sql.append(" UPDATETIME=SYSDATE() ");
		sql.append(" WHERE SERIAL =?");
		sql.append(" AND STATUS <> 0");
		sql.append(" AND STATUS <> 16");
		
		try {
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(i++, dto.getTransfer());
			if(dto.getStatus() != 0) ps.setInt(i++, dto.getStatus());
			ps.setInt(i++, dto.getUpdateUserId());
			ps.setString(i++, dto.getSerial());
			ps.executeUpdate();
			
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}
	
	@Override
	public void insertTransferRegisterInfo(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		int i = 1;

		try {
			StringBuffer sql = new StringBuffer("INSERT INTO ");
			sql.append(TmsTableNames.TMS_TRANSFER_REGISTER_INFO);
			sql.append(" (  ");
			
			sql.append(" SERIAL,  ");
			if (dto.getEpStandard() != 0) sql.append(" EPSTANDARD,  ");//环保达标
			if (dto.getCarReplaceType() != 0) sql.append(" CARREPLACETYPE,  ");//客车换型
			if (dto.getCarPeccancy() != 0) sql.append(" CARPECCANCY,  ");//车辆违章
			if (dto.getOverdue() != 0) sql.append(" OVERDUE,  ");//超检审核
			if (dto.getMortgage() != 0) sql.append(" MORTGAGE,  ");//抵押审核
			if (dto.getSealup() != 0) sql.append(" SEALUP,  ");//查封审核
			if (dto.getRegistration() != 0) sql.append(" REGISTRATION,  ");//登记证书
			if (dto.getDrivingLicense() != 0) sql.append(" DRIVINGLICENSE,  ");//行驶证
			if (dto.getScrapOverdue() != 0) sql.append(" SCRAPOVERDUE,  ");//报废超期
			if (dto.getRobbery() != 0) sql.append(" ROBBERY,  ");//盗抢审核
			if (dto.getOwnerEscaping() != 0) sql.append(" OWNERESCAPING,  ");//原车主在逃
			if (dto.getOwnerScrap() != 0) sql.append(" OWNERSCRAP,  ");//原车主报废车
			if (dto.getNewEscaping() != 0) sql.append(" NEWESCAPING,  ");//新车主在逃
			if (dto.getNewScrap() != 0) sql.append(" NEWSCRAP,  ");//新车主报废车
			if (dto.getNewLive() != 0) sql.append(" NEWLIVE,  ");//新车主居住证
			sql.append(" INSERTUSERID,  ");
			sql.append(" INSERTTIME  ");
			sql.append("  ) VALUES ( ?");
			if (dto.getEpStandard() != 0) sql.append(",?");
			if (dto.getCarReplaceType() != 0) sql.append(",?");
			if (dto.getCarPeccancy() != 0) sql.append(",?");
			if (dto.getOverdue() != 0) sql.append(",?");
			if (dto.getMortgage() != 0) sql.append(",?");
			if (dto.getSealup() != 0) sql.append(",?");
			if (dto.getRegistration() != 0) sql.append(",?");
			if (dto.getDrivingLicense() != 0) sql.append(",?");
			
			if (dto.getScrapOverdue() != 0) sql.append(",?");
			if (dto.getRobbery() != 0) sql.append(",?");
			if (dto.getOwnerEscaping() != 0) sql.append(",?");
			if (dto.getOwnerScrap() != 0) sql.append(",?");
			if (dto.getNewEscaping() != 0) sql.append(",?");
			if (dto.getNewScrap() != 0) sql.append(",?");
			if (dto.getNewLive() != 0) sql.append(",?");
			
			sql.append(" ,?,SYSDATE())");

			ps = conn.prepareStatement(sql.toString());

			ps.setString(i++, dto.getSerial());
			if (dto.getEpStandard() == 1) ps.setString(i++, "正常");
			if (dto.getEpStandard() == 2) ps.setString(i++, "未达标");
			if (dto.getCarReplaceType() == 1) ps.setString(i++, "否");
			if (dto.getCarReplaceType() == 2) ps.setString(i++, "是");
			if (dto.getCarPeccancy() == 1) ps.setString(i++, "正常");
			if (dto.getCarPeccancy() == 2) ps.setString(i++, "有违章未处理");
			if (dto.getOverdue() == 1) ps.setString(i++, "正常");
			if (dto.getOverdue() == 2) ps.setString(i++, "车辆检验逾期");
			if (dto.getMortgage() == 1) ps.setString(i++, "未抵押");
			if (dto.getMortgage() == 2) ps.setString(i++, "已抵押");
			if (dto.getSealup() == 1) ps.setString(i++, "正常");
			if (dto.getSealup() == 2) ps.setString(i++, "查封");
			if (dto.getRegistration() == 1) ps.setString(i++, "正常");
			if (dto.getRegistration() == 2) ps.setString(i++, "不符");
			if (dto.getDrivingLicense() == 1) ps.setString(i++, "正常");
			if (dto.getDrivingLicense() == 2) ps.setString(i++, "不符");
			if (dto.getScrapOverdue() == 1) ps.setString(i++, "正常");
			if (dto.getScrapOverdue() == 2) ps.setString(i++, "超期");
			if (dto.getRobbery() == 1) ps.setString(i++, "无");
			if (dto.getRobbery() == 2) ps.setString(i++, "有");
			if (dto.getOwnerEscaping() == 1) ps.setString(i++, "正常");
			if (dto.getOwnerEscaping() == 2) ps.setString(i++, "在逃");
			if (dto.getOwnerScrap() == 1) ps.setString(i++, "正常");
			if (dto.getOwnerScrap() == 2) ps.setString(i++, "强制报废");
			
			
			if (dto.getNewEscaping() == 1) ps.setString(i++, "正常");
			if (dto.getNewEscaping() == 2) ps.setString(i++, "在逃");
			if (dto.getNewScrap() == 1) ps.setString(i++, "正常");
			if (dto.getNewScrap() == 2) ps.setString(i++, "强制报废");
			if (dto.getNewLive() == 1) ps.setString(i++, "正常");
			if (dto.getNewLive() == 2) ps.setString(i++, "未通过");
			ps.setInt(i++, dto.getUpdateUserId());
			
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}

	}
	
	@Override
	public Map<String, Integer> getTransferAcceptedInfo(String serial) throws TmsDaoException{
		// 开始掉数据
				PreparedStatement ps = null;
				ResultSet rs = null;
				StringBuffer sql = new StringBuffer("SELECT ");
				sql.append("epStandard      ,");
				sql.append("carReplaceType  ,");
				sql.append("carPeccancy     ,");
				sql.append("overdue         ,");
				sql.append("mortgage        ,");
				sql.append("sealup          ,");
				sql.append("registration    ,");
				sql.append("drivingLicense  ,");
				sql.append("scrapOverdue    ,");
				sql.append("robbery         ,");
				sql.append("ownerEscaping   ,");
				sql.append("ownerScrap      ,");
				sql.append("ownerLive       ,");
				sql.append("newEscaping     ,");
				sql.append("newScrap        ,");
				sql.append("newLive        ");
				sql.append("FROM ");
				sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
				sql.append(" where serial='" + serial + "' limit 1");
				Map<String, Integer> map = new HashMap<String, Integer>();
				try {
					ps = conn.prepareStatement(sql.toString());
					rs = ps.executeQuery();
					while (rs.next()) {
						map.put("epStandard",      rs.getInt("epStandard"));
						map.put("carReplaceType",  rs.getInt("carReplaceType"));
						map.put("carPeccancy",     rs.getInt("carPeccancy"));
						map.put("overdue",         rs.getInt("overdue"));
						map.put("mortgage",        rs.getInt("mortgage"));
						map.put("sealup",          rs.getInt("sealup"));
						map.put("registration",    rs.getInt("registration"));
						map.put("drivingLicense",  rs.getInt("drivingLicense"));
						map.put("scrapOverdue",    rs.getInt("scrapOverdue"));
						map.put("robbery",         rs.getInt("robbery"));
						map.put("ownerEscaping",   rs.getInt("ownerEscaping"));
						map.put("ownerScrap",      rs.getInt("ownerScrap"));
						map.put("ownerLive",       rs.getInt("ownerLive"));
						map.put("newEscaping",     rs.getInt("newEscaping"));
						map.put("newScrap",        rs.getInt("newScrap"));
						map.put("newLive",         rs.getInt("newLive"));
					}
				} catch (SQLException e) {
					throw new TmsDaoException(e.toString());

				} finally {
					super.close(rs, ps);
				}
				return map;
	}
	
	@Override
	public Map<String, Integer> getTransferRegisterInfo(String serial) throws TmsDaoException {

		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("epStandard      ,");
		sql.append("carReplaceType  ,");
		sql.append("carPeccancy     ,");
		sql.append("overdue         ,");
		sql.append("mortgage        ,");
		sql.append("sealup          ,");
		sql.append("registration    ,");
		sql.append("drivingLicense  ,");
		sql.append("scrapOverdue    ,");
		sql.append("robbery         ,");
		sql.append("ownerEscaping   ,");
		sql.append("ownerScrap      ,");
		sql.append("ownerLive       ,");
		sql.append("newEscaping     ,");
		sql.append("newScrap        ,");
		sql.append("newLive        ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_REGISTER_INFO);
		sql.append(" where serial='" + serial + "' limit 1");
		Map<String, Integer> map = new HashMap<String, Integer>();
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				map.put("epStandard",      rs.getInt("epStandard"));
				map.put("carReplaceType",  rs.getInt("carReplaceType"));
				map.put("carPeccancy",     rs.getInt("carPeccancy"));
				map.put("overdue",         rs.getInt("overdue"));
				map.put("mortgage",        rs.getInt("mortgage"));
				map.put("sealup",          rs.getInt("sealup"));
				map.put("registration",    rs.getInt("registration"));
				map.put("drivingLicense",  rs.getInt("drivingLicense"));
				map.put("scrapOverdue",    rs.getInt("scrapOverdue"));
				map.put("robbery",         rs.getInt("robbery"));
				map.put("ownerEscaping",   rs.getInt("ownerEscaping"));
				map.put("ownerScrap",      rs.getInt("ownerScrap"));
				map.put("ownerLive",       rs.getInt("ownerLive"));
				map.put("newEscaping",     rs.getInt("newEscaping"));
				map.put("newScrap",        rs.getInt("newScrap"));
				map.put("newLive",         rs.getInt("newLive"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return map;
	
	}
	
	@Override
	public List<String> findLicensePlateList(String licensePlate) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<String> list = new ArrayList<String>();

		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" LICENSEPLATE ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE LICENSEPLATE like '%");
		sql.append(licensePlate);
		sql.append("%'");
		sql.append("AND STATUS <> 16");
		sql.append(" ORDER BY SERIAL ASC LIMIT 30");

		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				list.add(rs.getString("LICENSEPLATE"));
			}
			return list;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public List<String> findVinList(String vin) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		List<String> list = new ArrayList<String>();

		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append(" VIN ");
		sql.append(" FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append(" WHERE VIN like '%");
		sql.append(vin);
		sql.append("%'");
		sql.append("AND STATUS <> 16 AND STATUS <> 0");
		sql.append(" ORDER BY SERIAL ASC LIMIT 30");

		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				list.add(rs.getString("VIN"));
			}
			return list;
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public TransferAcceptedInfoDto getAcceptInfoBySerial(String serial, String licensePlate, String vin)
			throws TmsDaoException {
		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("A.ID, ");
		sql.append("A.SERIAL, ");
		sql.append("A.MARKETTYPE, ");
		sql.append("A.CARMARKETINCITY, ");
		sql.append("A.BASICCARID, ");
		sql.append("A.CY_CARDTYPE, ");
		sql.append("A.LICENSEPLATE, ");
		sql.append("A.VIN, ");
		sql.append("A.CARDTYPE, ");
		sql.append("A.CARCLASS, ");
		sql.append("A.TRANSFER, ");
		sql.append("A.CHANGEUSENATURE, ");
		sql.append("A.REPEATVIN, ");
		sql.append("A.REPEATENGINENUM, ");
		sql.append("A.CHANGEALLCAR, ");
		sql.append("A.APPLYCERTIFICATE, ");
		sql.append("A.REPLACEMENTCERTIFICATE, ");
		sql.append("A.MONITORINGSALES, ");
		sql.append("A.OTHER, ");
		sql.append("A.VINNUM, ");
		sql.append("A.ENGINENUM, ");
		sql.append("A.BRANDMODEL, ");
		sql.append("A.CY_COLOR, ");
		sql.append("A.CY_PASSENGER, ");
		sql.append("A.CY_CARTYPE, ");
		sql.append("A.PLATEORTIREEXTERIOR, ");
		sql.append("A.TIREINTACT, ");
		sql.append("A.SEATBELT, ");
		sql.append("A.NUMBERAXES, ");
		sql.append("A.TIRESIZE, ");
		sql.append("A.LATERALPORTIONOF, ");
		sql.append("A.REFLECTIVEMARK, ");
		sql.append("A.FIREEXTINGUISHER, ");
		sql.append("A.DRIVINGRECORD, ");
		sql.append("A.SECURITY, ");
		sql.append("A.EXTERNALMARKING, ");
		sql.append("A.SIREN, ");
		sql.append("A.SECURITYTECHNOLOGY, ");
		sql.append("A.CHECKCONCLUSION, ");
		sql.append("A.PHOTO_1, ");
		sql.append("A.PHOTO_2, ");
		sql.append("A.PHOTO_3, ");
		sql.append("A.PHOTO_4, ");
		sql.append("A.REMARK, ");
		sql.append("A.LC_PRINTNUM, ");
		sql.append("A.LC_PRINTUSERID, ");
		sql.append("A.CY_PRINTNUM, ");
		sql.append("A.CY_PRINTUSERID, ");
		sql.append("A.PG_PRICE, ");
		sql.append("A.PG_PRINTNUM, ");
		sql.append("A.PG_PRINTUSERID, ");
		sql.append("A.DB_PRINTNUM, ");
		sql.append("A.DB_PRINTUSERID, ");
		sql.append("A.OWNERTYPE, ");
		sql.append("A.CAROWNER, ");
		sql.append("A.CAROWNERIDCARDNO, ");
		sql.append("A.OWNERPHONE, ");
		sql.append("A.OWNERADDRESS, ");
		sql.append("A.OWNERORGNO, ");
		sql.append("A.AGENTNAME, ");
		sql.append("A.AGENTOWNERIDCARDNO, ");
		sql.append("A.AGENTADDRESS, ");
		sql.append("A.AGENTPHONE, ");
		sql.append("A.NEWOWNERTYPE, ");
		sql.append("A.NEWCAROWNER, ");
		sql.append("A.NEWCAROWNERIDCARDNO, ");
		sql.append("A.NEWOWNERPHONE, ");
		sql.append("A.NEWOWNERTELPHONE, ");
		sql.append("A.NEWOWNERADDRESS, ");
		sql.append("A.NEWOWNERORGNO, ");
		sql.append("A.NEWOWNERZIPCODE, ");
		sql.append("A.NEWOWNERMAILADDRESS, ");
		sql.append("A.NEWAGENTNAME, ");
		sql.append("A.NEWAGENTOWNERIDCARDNO, ");
		sql.append("A.NEWAGENTADDRESS, ");
		sql.append("A.NEWAGENTPHONE, ");
		sql.append("A.OWNERSGROUPPHOTO, ");
		sql.append("A.MATERIALIMAGES1, ");
		sql.append("A.MATERIALIMAGES2, ");
		sql.append("A.MATERIALIMAGES3, ");
		sql.append("A.MATERIALIMAGES4, ");
		sql.append("A.MATERIALIMAGES5, ");
		sql.append("A.PRICE, ");
		sql.append("A.TRANSFERPRICE, ");
		sql.append("A.EXTENDEDPRICE, ");
		sql.append("A.DOUBLETRANSFERPRICE, ");
		sql.append("A.SOURCETYPE, ");
		sql.append("A.STATUS, ");
		sql.append("A.AGENTTIME, ");
		sql.append("A.GH_PRINTNUM, ");
		sql.append("A.GH_PRINTUSERID, ");
		sql.append("A.ZY_PRINTNUM, ");
		sql.append("A.ZY_PRINTUSERID, ");
		sql.append("A.LZ_PRINTNUM, ");
		sql.append("A.LZ_PRINTUSERID, ");
		sql.append("A.XS_PRINTNUM, ");
		sql.append("A.XS_PRINTUSERID, ");
		sql.append("A.TRANSFERTYPE, ");
		sql.append("A.CARMARKETIN, ");
		sql.append("A.MOVEOUTPROVINCE, ");
		sql.append("A.MOVEOUTCITY, ");
		sql.append("A.TAXNO, ");
		sql.append("A.TRANSNO, ");
		sql.append("A.TRANSMARKET, ");
		sql.append("A.PAYMENTPEOPLE, ");
		sql.append("A.LICENSEACCEPTIME, ");
		sql.append("A.GAINTYPE, ");//
		sql.append("A.ATTNID, ");
		sql.append("A.INSERTUSERID, ");
		sql.append("A.LC_PRINTTIME, ");
		sql.append("A.CY_PRINTTIME, ");
		sql.append("A.PG_TIME, ");
		sql.append("A.PG_PRINTTIME, ");
		sql.append("A.DB_PRINTTIME, ");
		sql.append("A.GH_PRINTTIME, ");
		sql.append("A.ZY_PRINTTIME, ");
		sql.append("A.LZ_PRINTTIME, ");
		sql.append("A.XS_PRINTTIME, ");
		sql.append("A.INSERTTIME, ");
		sql.append("A.UPDATEUSERID, ");
		sql.append("A.UPDATETIME, ");
		sql.append("A.PRETRANSFER, ");
		sql.append("A.CHANGETRADETICKET, ");
		sql.append("A.REGISTRATION, ");
		sql.append("A.TRANSFERREGISTER, ");
		sql.append("A.CHANGESVACATE, ");
		sql.append("A.WAITFORSTATUS, ");
		sql.append("A.CHECKUSERID,  ");
		sql.append("A.PICCHANGENUM, ");
		sql.append("A.CHECKFILESTATUS, ");
		sql.append("A.MEMBERID, ");
		sql.append("A.ISMATCH, ");
		sql.append("A.VENDORID, ");
		sql.append("B.REALNAME, ");
		sql.append("C.TRANSFERPRICEDATE, ");
		sql.append("C.CHECKPRICEDATE, ");
		sql.append("A.CARTYPE, ");
		sql.append("A.COUNTRYSTYLE, ");
		sql.append("A.CARUSE, ");
		sql.append("A.CARDTYPE, ");
		sql.append("A.REGISTERCARDNO, ");
		sql.append("A.REGDATE, ");
		sql.append("A.VENDORCODE, ");
		sql.append("A.MODELCODE, ");
		sql.append("A.MATERIALIMAGES6, ");
		sql.append("A.MATERIALIMAGES7, ");
		sql.append("A.MATERIALIMAGES8, ");
		sql.append("A.MATERIALIMAGES9, ");
		sql.append("A.MATERIALIMAGES10, ");
		sql.append("A.CHANGEBODY ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A" + " LEFT JOIN " + TmsTableNames.TMS_MEMBER
				+ " B on(A.MEMBERID = B.MEMBERID)");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_TRANSFER_FINANCE_INFO + " C ON (A.SERIAL = C.SERIAL) ");
		sql.append("   WHERE 1=1 ");
		if (serial != null && !"".equals(serial)) {
			sql.append(" AND A.SERIAL =" + serial + " ");
		}
		if (licensePlate != null && !"".equals(licensePlate)) {
			sql.append(" AND A.LICENSEPLATE ='" + licensePlate + "' ");
		}
		if (vin != null && !"".equals(vin)) {
			sql.append(" AND A.VIN ='" + vin + "' ");
		}
		sql.append(" ORDER BY A.INSERTTIME ASC  ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setChangeBody(rs.getInt("CHANGEBODY"));
				dto.setCarMarketIn(rs.getString("CARMARKETINCITY"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setCy_carType(rs.getString("CY_CARDTYPE"));
				dto.setCarType(rs.getString("CARTYPE"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
				dto.setPg_price(rs.getInt("PG_PRICE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
				dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
				dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
				dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
				dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setInsertUserid(rs.getInt("INSERTUSERID"));
				dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
				dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
				dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
				dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
				dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
				dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
				dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setPreTransfer(rs.getInt("PRETRANSFER"));
				dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
				dto.setMemberId(rs.getString("MEMBERID"));
				dto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS"));
				dto.setMemberRealName(rs.getString("REALNAME"));
				dto.setTransferPriceDate(rs.getTimestamp("TRANSFERPRICEDATE"));
				dto.setCheckPriceDate(rs.getTimestamp("CHECKPRICEDATE"));
				dto.setIsMatch(rs.getInt("ISMATCH"));
				dto.setVendorId(rs.getString("VENDORID"));
				dto.setCarType(rs.getString("CARTYPE"));
				dto.setCountryStyle(rs.getString("COUNTRYSTYLE"));
				dto.setCarUse(rs.getString("CARUSE"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setRegisterCardNo(rs.getString("REGISTERCARDNO"));
				dto.setRegDate(rs.getTimestamp("REGDATE"));
				dto.setVendorCode(rs.getString("VENDORCODE"));
				dto.setModelCode(rs.getString("MODELCODE"));
				dto.setMaterialImages6(rs.getString("MATERIALIMAGES6"));
				dto.setMaterialImages7(rs.getString("MATERIALIMAGES7"));
				dto.setMaterialImages8(rs.getString("MATERIALIMAGES8"));
				dto.setMaterialImages9(rs.getString("MATERIALIMAGES9"));
				dto.setMaterialImages10(rs.getString("MATERIALIMAGES10"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return dto;
	}

	
	@Override
	public void updateAcceptInfoBySerial(int cyPrintNum, int lcPrintNum,String serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" CY_PRINTNUM=?,");
			sql.append(" PG_PRINTTIME=SYSDATE(),");
			sql.append(" CY_PRINTTIME=SYSDATE(),");
			sql.append(" CY_PRINTUSERID = 1,");
			sql.append(" LC_PRINTNUM=?,");
			sql.append(" LC_PRINTTIME=SYSDATE(),");
			sql.append(" LC_PRINTUSERID=1 ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, cyPrintNum);
			ps.setInt(2, lcPrintNum);
			ps.setString(3,serial);
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptInfo4TransferConfirmBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" VIN=?,  			");
			sql.append(" VENDORCODE=?,  			");
			sql.append(" MODELCODE=?,  			");
			sql.append(" CARDTYPE=?,  			");
			sql.append(" COUNTRYSTYLE=?,  			");
			sql.append(" CARUSE=?,  			");
			sql.append(" CARTYPE=?,  			");
			sql.append(" REGISTERCARDNO=?,  			");
			sql.append(" REGDATE=?,  			");
			sql.append(" GAINTYPE=?,  			");
			sql.append(" CARMARKETINPROV=?,  			");
			sql.append(" CARMARKETINCITY=?,  			");
			sql.append(" PRICE=?,  			");
			sql.append(" OWNERTYPE=?,  			");
			sql.append(" CAROWNER=?,  			");
			sql.append(" OWNERPHONE=?,  			");
			sql.append(" OWNERADDRESS=?,  			");
			sql.append(" AGENTOWNERIDCARDNO=?,  			");
			sql.append(" AGENTNAME=?,  			");
			sql.append(" AGENTPHONE=?,  			");
			sql.append(" AGENTADDRESS=?,  			");
			sql.append(" NEWOWNERTYPE=?,  			");
			sql.append(" NEWCAROWNER=?,  			");
			sql.append(" NEWOWNERPHONE=?,  			");
			sql.append(" NEWOWNERADDRESS=?,  			");
			sql.append(" NEWOWNERZIPCODE=?,  			");
			sql.append(" NEWAGENTOWNERIDCARDNO=?,  			");
			sql.append(" NEWAGENTNAME=?,  			");
			sql.append(" NEWAGENTPHONE=?,  			");
			sql.append(" NEWAGENTADDRESS=?,  			");
			sql.append(" MATERIALIMAGES1=?,  			");
			sql.append(" MATERIALIMAGES2=?,  			");
			sql.append(" MATERIALIMAGES3=?,  			");
			sql.append(" MATERIALIMAGES4=?,  			");
			sql.append(" MATERIALIMAGES5=?,  			");
			sql.append(" MATERIALIMAGES6=?,  			");
			sql.append(" MATERIALIMAGES7=?,  			");
			sql.append(" MATERIALIMAGES8=?,  			");
			sql.append(" MATERIALIMAGES9=?,  			");
			sql.append(" MATERIALIMAGES10=?,  			");
			sql.append(" STATUS=?,  			");
			sql.append(" ZY_PRINTNUM=?,  			");
			sql.append(" ZY_PRINTTIME=SYSDATE(),  			");
			sql.append(" CARNAME=?,  			");
			sql.append(" BRANDID=?,  			");
			sql.append(" CARSTYLEID=?,  			");
			sql.append(" ISMATCH=?,  			");
			sql.append(" VENDORID=? , 			");
			sql.append(" TRANSFER=? , 			");
			sql.append(" TRANSFERREGISTER=?,  			");
			sql.append(" CHANGEBODY=?,  			");
			sql.append(" UPDATEUSERID=?,		");
			sql.append(" CAROWNERIDCARDNO=?,		");
			sql.append(" OWNERORGNO=?,		");
			sql.append(" NEWOWNERORGNO=?,		");
			sql.append(" NEWCAROWNERIDCARDNO=?,		");
			sql.append(" UPDATETIME=SYSDATE()  			");
			sql.append(" WHERE SERIAL =?  	");
			ps = conn.prepareStatement(sql.toString());
			int i=0;
			ps.setString(++i, dto.getVin());
			ps.setString(++i, dto.getVendorCode());
			ps.setString(++i, dto.getModelCode() );
			ps.setInt(++i, dto.getCy_cardType()==null?0:dto.getCy_cardType() );
			ps.setString(++i, StringUtil.isNullOrBlank(dto.getCountryStyle())?"0":dto.getCountryStyle() );
			ps.setString(++i, StringUtil.isNullOrBlank(dto.getCarUse())?"0":dto.getCarUse()  );
			ps.setString(++i,  StringUtil.isNullOrBlank(dto.getCarType())?"0":dto.getCarType() );
			ps.setString(++i, dto.getRegisterCardNo() );
			ps.setString(++i,DateUtil.getDateByTimeStamp( dto.getRegDate()) );
			ps.setInt(++i, dto.getGainType() );
			ps.setString(++i, String.valueOf(dto.getCarMarketInProv()) );
			ps.setString(++i, String.valueOf(dto.getCarMarketInCity() ));
			ps.setInt(++i, dto.getPrice()==null?0:dto.getPrice() );
			ps.setInt(++i, dto.getOwnerType() );
			ps.setString(++i, dto.getCarOwner() );
			ps.setString(++i, dto.getOwnerPhone() );
			ps.setString(++i, dto.getOwnerAddress() );
			ps.setString(++i, dto.getAgentOwnerIdCardNo() );
			ps.setString(++i, dto.getAgentName() );
			ps.setString(++i, dto.getAgentPhone() );
			ps.setString(++i, dto.getAgentAddress() );
			ps.setInt(++i, dto.getNewOwnerType() );
			ps.setString(++i, dto.getNewcarOwner() );
			ps.setString(++i, dto.getNewOwnerPhone() );
			ps.setString(++i, dto.getNewOwnerAddress() );
			ps.setString(++i, dto.getNewOwnerZipCode() );
			ps.setString(++i, dto.getNewAgentOwnerIdCardNo() );
			ps.setString(++i, dto.getNewAgentName() );
			ps.setString(++i, dto.getNewAgentPhone() );
			ps.setString(++i, dto.getNewAgentAddress() );
			ps.setString(++i, dto.getMaterialImages1() );
			ps.setString(++i, dto.getMaterialImages2() );
			ps.setString(++i, dto.getMaterialImages3() );
			ps.setString(++i, dto.getMaterialImages4() );
			ps.setString(++i, dto.getMaterialImages5() );
			ps.setString(++i, dto.getMaterialImages6() );
			ps.setString(++i, dto.getMaterialImages7() );
			ps.setString(++i, dto.getMaterialImages8() );
			ps.setString(++i, dto.getMaterialImages9() );
			ps.setString(++i, dto.getMaterialImages10() );
			ps.setInt(++i, dto.getStatus()==null?0:dto.getStatus() );
			ps.setInt(++i, dto.getZy_printnum() );
			ps.setString(++i, dto.getCarName() );
			ps.setString(++i, dto.getBrandId() );
			ps.setString(++i, dto.getCarStyleId() );
			ps.setInt(++i, dto.getIsMatch() );
			ps.setString(++i, dto.getVendorId() );
			ps.setInt(++i, dto.getTransfer() );
			ps.setInt(++i, dto.getTransferRegister() );
			ps.setInt(++i, dto.getChangeBody() );
			ps.setInt(++i, dto.getUpdateUserId() );
			ps.setString(++i, dto.getCarOwnerIdCardNo() );
			ps.setString(++i, dto.getOwnerOrgNo());
			ps.setString(++i, dto.getNewOwnerOrgNo());
			ps.setString(++i, dto.getNewcarOwnerIdCardNo());
			ps.setString(++i, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}
	
	
	@Override
	public TransferAcceptedInfoDto checkTransferCompleted(String v,int type)throws TmsDaoException{
		TransferAcceptedInfoDto r = null;
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("ID,STATUS ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		if(type == 1) {
			sql.append(" WHERE VIN ='").append(v).append("'");
		}else if(type == 2) {
			sql.append(" WHERE SERIAL ='").append(v).append("'");
		}else {
			sql.append(" WHERE LICENSEPLATE ='").append(v).append("'");
		}
		sql.append(" ORDER BY INSERTTIME DESC LIMIT 1");
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				r = new TransferAcceptedInfoDto();
				r.setStatus(rs.getInt("STATUS"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}
	
	
	/**
	 * 根据流水号查询受理信息id
	 * 
	 */
	@Override
	public String getIdBySerial(String serial) throws TmsDaoException {
		// 开始掉数据
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("ID ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
		sql.append("   WHERE SERIAL ='" + serial + "' ");
		String id = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			while (rs.next()) {
				id = String.valueOf(rs.getInt("ID"));
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return id;
	}
	
	
	@Override
	public void updateAcceptInfo000102(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET");
			sql.append(" LICENSEPLATE=?,");
			sql.append(" VIN=?,");
			sql.append(" cardType=?,");
			sql.append(" licensePlateCol=?, ");
			if(StringUtils.isNotEmpty(dto.getPhoto_1())) sql.append(" PHOTO_1=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages1())) sql.append(" MATERIALIMAGES1=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages2())) sql.append(" MATERIALIMAGES2=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages3())) sql.append(" MATERIALIMAGES3=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages4())) sql.append(" MATERIALIMAGES4=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages5())) sql.append(" MATERIALIMAGES5=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages6())) sql.append(" MATERIALIMAGES6=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages7())) sql.append(" MATERIALIMAGES7=?,");
			if(StringUtils.isNotEmpty(dto.getMaterialImages8())) sql.append(" MATERIALIMAGES8=?,");
			sql.append(" transferType=?,");
			if(dto.getCarMarketInProv() > 0) sql.append(" CARMARKETINPROV=?,");
			if(dto.getCarMarketInCity() > 0) sql.append(" CARMARKETINCITY=?,");
			sql.append(" attnId=?,");
			if(dto.getCarClass() != null && dto.getCarClass() > 0)sql.append(" catClass=?,");
			if(StringUtils.isNotEmpty(dto.getCarName())) sql.append(" CARNAME=?,");
			if(StringUtils.isNotEmpty(dto.getVendorId())) sql.append(" VENDORID=?,");
			if(StringUtils.isNotEmpty(dto.getBrandId())) sql.append(" BRANDID=?,");
			if(StringUtils.isNotEmpty(dto.getCarStyleId())) sql.append(" CARSTYLEID=?,");
			if(dto.getIsMatch() > 0) sql.append(" ISMATCH=?,");
			sql.append(" MEMBERID=?,");
			if(dto.getUpdateUserId() > 0) sql.append(" updateUserId=?,");
			sql.append(" transferPrice=?,");
			sql.append(" updateTime=SYSDATE(),");
			sql.append(" payTime=SYSDATE() ");
			sql.append(" WHERE SERIAL =? ");
			ps = conn.prepareStatement(sql.toString());
			int i=0;
			ps.setString(++i, dto.getLicensePlate());
			ps.setString(++i, dto.getVin());
			ps.setInt(++i, dto.getCardType() );
			ps.setString(++i, dto.getLicensePlateCol() );
			if(StringUtils.isNotEmpty(dto.getPhoto_1())) ps.setString(++i, dto.getPhoto_1());
			if(StringUtils.isNotEmpty(dto.getMaterialImages1())) ps.setString(++i, dto.getMaterialImages1());
			if(StringUtils.isNotEmpty(dto.getMaterialImages2())) ps.setString(++i, dto.getMaterialImages2());
			if(StringUtils.isNotEmpty(dto.getMaterialImages3())) ps.setString(++i, dto.getMaterialImages3());
			if(StringUtils.isNotEmpty(dto.getMaterialImages4())) ps.setString(++i, dto.getMaterialImages4());
			if(StringUtils.isNotEmpty(dto.getMaterialImages5())) ps.setString(++i, dto.getMaterialImages5());
			if(StringUtils.isNotEmpty(dto.getMaterialImages6())) ps.setString(++i, dto.getMaterialImages6());
			if(StringUtils.isNotEmpty(dto.getMaterialImages7())) ps.setString(++i, dto.getMaterialImages7());
			if(StringUtils.isNotEmpty(dto.getMaterialImages8())) ps.setString(++i, dto.getMaterialImages8());
			ps.setInt(++i, dto.getTransferType());
			if(dto.getCarMarketInProv() > 0) ps.setString(++i, String.valueOf(dto.getCarMarketInProv()) );
			if(dto.getCarMarketInCity() > 0) ps.setString(++i, String.valueOf(dto.getCarMarketInCity() ));
			ps.setString(++i, dto.getAttnId());
			if(dto.getCarClass() != null && dto.getCarClass() > 0)ps.setInt(++i, dto.getCarClass() );
			if(StringUtils.isNotEmpty(dto.getCarName())) ps.setString(++i, dto.getCarName() );
			if(StringUtils.isNotEmpty(dto.getVendorId())) ps.setString(++i, dto.getVendorId() );
			if(StringUtils.isNotEmpty(dto.getBrandId())) ps.setString(++i, dto.getBrandId() );
			if(StringUtils.isNotEmpty(dto.getCarStyleId())) ps.setString(++i, dto.getCarStyleId() );
			if(dto.getIsMatch() > 0) ps.setInt(++i, dto.getIsMatch() );
			ps.setString(++i, dto.getMemberId() );
			if(dto.getUpdateUserId() > 0) ps.setInt(++i, dto.getUpdateUserId() );
			ps.setInt(++i, dto.getTransferPrice() );
			ps.setString(++i, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}
	
	@Override
	public void saveAcceptInfo000102(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("INSERT INTO   ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" (  ");
			sql.append(" SERIAL ,");
			sql.append(" LICENSEPLATE, ");
			sql.append(" VIN, ");
			sql.append(" CARDTYPE, ");
			sql.append(" licensePlateCol, ");
			sql.append(" PHOTO_1,");
			sql.append(" MATERIALIMAGES1, ");
			sql.append(" MATERIALIMAGES2, ");
			sql.append(" MATERIALIMAGES3, ");
			sql.append(" MATERIALIMAGES4, ");
			sql.append(" MATERIALIMAGES5, ");
			sql.append(" MATERIALIMAGES6, ");
			sql.append(" MATERIALIMAGES7, ");
			sql.append(" MATERIALIMAGES8, ");
			sql.append(" transferType, ");
			sql.append(" CARMARKETINPROV, ");
			sql.append(" CARMARKETINCITY, ");
			sql.append(" attnId, ");
			sql.append(" catClass, ");
			sql.append(" CARNAME, ");
			sql.append(" VENDORID,");
			sql.append(" BRANDID,");
			sql.append(" CARSTYLEID,");
			sql.append(" ISMATCH,");
			sql.append(" preTransfer,");
			sql.append(" status,");
			sql.append(" transferPrice,");
			sql.append(" insertUserid,");
			sql.append(" updateUserId,");
			sql.append(" insertTime,");
			sql.append(" updateTime,");
			sql.append(" transfer,");
			sql.append(" transferRegister,");
			sql.append(" memberId");
			sql.append("  ) VALUES ( ");
			sql.append(" ?,?,?,?,?,?,?,?,?,?," + "?,?,?,?,?,?,?,?,?,?" + ",?,?,?,?,?,?,?,?,?,now(),now(),?,?,?)");
			ps = conn.prepareStatement(sql.toString());
			int i=0;
			ps.setString(++i, dto.getSerial());
			ps.setString(++i, dto.getLicensePlate());
			ps.setString(++i, dto.getVin());
			ps.setInt(++i, dto.getCardType() );
			ps.setString(++i, dto.getLicensePlateCol() );
			ps.setString(++i, dto.getPhoto_1());
			ps.setString(++i, dto.getMaterialImages1());
			ps.setString(++i, dto.getMaterialImages2());
			ps.setString(++i, dto.getMaterialImages3());
			ps.setString(++i, dto.getMaterialImages4());
			ps.setString(++i, dto.getMaterialImages5());
			ps.setString(++i, dto.getMaterialImages6());
			ps.setString(++i, dto.getMaterialImages7());
			ps.setString(++i, dto.getMaterialImages8());
			ps.setInt(++i, dto.getTransferType());
			ps.setString(++i, String.valueOf(dto.getCarMarketInProv()) );
			ps.setString(++i, String.valueOf(dto.getCarMarketInCity() ));
			ps.setString(++i, dto.getAttnId());
			ps.setInt(++i, dto.getCarClass() );
			ps.setString(++i, dto.getCarName() );
			ps.setString(++i, dto.getVendorId() );
			ps.setString(++i, dto.getBrandId() );
			ps.setString(++i, dto.getCarStyleId() );
			ps.setInt(++i, dto.getIsMatch() );
			ps.setInt(++i, 1 );
			ps.setInt(++i, 1 );
			ps.setInt(++i, 1 );
			ps.setInt(++i, dto.getInsertUserid() );
			ps.setInt(++i, dto.getUpdateUserId() );
			ps.setInt(++i, dto.getTransfer() );
			ps.setInt(++i, dto.getTransferRegister() );
			ps.setString(++i, dto.getMemberId() );
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}
	
	/**
	 * 20171229
	 */
	@Override
	public TransferAcceptedInfoDto getAssessInfo001(String serial) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		StringBuffer sql = new StringBuffer("SELECT ");
		sql.append("A.ID, ");
		sql.append("A.SERIAL, ");
		sql.append("A.MARKETTYPE, ");
		sql.append("A.BASICCARID, ");
		sql.append("A.LICENSEPLATE, ");
		sql.append("A.VIN, ");
		sql.append("A.CARTYPE, ");
		sql.append("A.CY_CARDTYPE, ");
		sql.append("A.CARCLASS, ");
		sql.append("A.TRANSFER, ");
		sql.append("A.CHANGEUSENATURE, ");
		sql.append("A.REPEATVIN, ");
		sql.append("A.REPEATENGINENUM, ");
		sql.append("A.CHANGEALLCAR, ");
		sql.append("A.APPLYCERTIFICATE, ");
		sql.append("A.REPLACEMENTCERTIFICATE, ");
		sql.append("A.MONITORINGSALES, ");
		sql.append("A.OTHER, ");
		sql.append("A.VINNUM, ");
		sql.append("A.CARMARKETINCITY, ");
		sql.append("A.ENGINENUM, ");
		sql.append("A.BRANDMODEL, ");
		sql.append("A.CY_COLOR, ");
		sql.append("A.CY_PASSENGER, ");
		sql.append("A.CY_CARTYPE, ");
		sql.append("A.PLATEORTIREEXTERIOR, ");
		sql.append("A.TIREINTACT, ");
		sql.append("A.SEATBELT, ");
		sql.append("A.NUMBERAXES, ");
		sql.append("A.TIRESIZE, ");
		sql.append("A.LATERALPORTIONOF, ");
		sql.append("A.REFLECTIVEMARK, ");
		sql.append("A.FIREEXTINGUISHER, ");
		sql.append("A.DRIVINGRECORD, ");
		sql.append("A.SECURITY, ");
		sql.append("A.EXTERNALMARKING, ");
		sql.append("A.SIREN, ");
		sql.append("A.SECURITYTECHNOLOGY, ");
		sql.append("A.CHECKCONCLUSION, ");
		sql.append("A.PHOTO_1, ");
		sql.append("A.PHOTO_2, ");
		sql.append("A.PHOTO_3, ");
		sql.append("A.PHOTO_4, ");
		sql.append("A.REMARK, ");
		sql.append("A.LC_PRINTNUM, ");
		sql.append("A.LC_PRINTUSERID, ");
		sql.append("A.CY_PRINTNUM, ");
		sql.append("A.CY_PRINTUSERID, ");
		sql.append("A.PG_PRICE, ");
		sql.append("A.PG_PRINTNUM, ");
		sql.append("A.PG_PRINTUSERID, ");
		sql.append("A.DB_PRINTNUM, ");
		sql.append("A.DB_PRINTUSERID, ");
		sql.append("A.OWNERTYPE, ");
		sql.append("A.CAROWNER, ");
		sql.append("A.OWNERPHONE, ");
		sql.append("A.OWNERADDRESS, ");
		sql.append("A.OWNERORGNO, ");
		sql.append("A.AGENTNAME, ");
		sql.append("A.AGENTOWNERIDCARDNO, ");
		sql.append("A.AGENTADDRESS, ");
		sql.append("A.AGENTPHONE, ");
		sql.append("A.NEWOWNERTYPE, ");
		sql.append("A.NEWCAROWNER, ");
		sql.append("A.NEWCAROWNERIDCARDNO, ");
		sql.append("A.NEWOWNERPHONE, ");
		sql.append("A.NEWOWNERTELPHONE, ");
		sql.append("A.NEWOWNERADDRESS, ");
		sql.append("A.NEWOWNERORGNO, ");
		sql.append("A.NEWOWNERZIPCODE, ");
		sql.append("A.NEWOWNERMAILADDRESS, ");
		sql.append("A.NEWAGENTNAME, ");
		sql.append("A.NEWAGENTOWNERIDCARDNO, ");
		sql.append("A.NEWAGENTADDRESS, ");
		sql.append("A.NEWAGENTPHONE, ");
		sql.append("A.OWNERSGROUPPHOTO, ");
		sql.append("A.MATERIALIMAGES1, ");
		sql.append("A.MATERIALIMAGES2, ");
		sql.append("A.MATERIALIMAGES3, ");
		sql.append("A.MATERIALIMAGES4, ");
		sql.append("A.MATERIALIMAGES5, ");
		sql.append("A.MATERIALIMAGES6, ");
		sql.append("A.MATERIALIMAGES7, ");
		sql.append("A.MATERIALIMAGES8, ");
		sql.append("A.MATERIALIMAGES9, ");
		sql.append("A.MATERIALIMAGES10, ");
		sql.append("A.PRICE, ");
		sql.append("A.TRANSFERPRICE, ");
		sql.append("A.EXTENDEDPRICE, ");
		sql.append("A.DOUBLETRANSFERPRICE, ");
		sql.append("A.SOURCETYPE, ");
		sql.append("A.STATUS, ");
		sql.append("A.AGENTTIME, ");
		sql.append("A.GH_PRINTNUM, ");
		sql.append("A.GH_PRINTUSERID, ");
		sql.append("A.ZY_PRINTNUM, ");
		sql.append("A.ZY_PRINTUSERID, ");
		sql.append("A.LZ_PRINTNUM, ");
		sql.append("A.LZ_PRINTUSERID, ");
		sql.append("A.XS_PRINTNUM, ");
		sql.append("A.XS_PRINTUSERID, ");
		sql.append("A.TRANSFERTYPE, ");
		sql.append("A.MOVEOUTPROVINCE, ");
		sql.append("A.MOVEOUTCITY, ");
		sql.append("A.TAXNO, ");
		sql.append("A.TRANSNO, ");
		sql.append("A.TRANSMARKET, ");
		sql.append("A.PAYMENTPEOPLE, ");
		sql.append("A.LICENSEACCEPTIME, ");
		sql.append("A.GAINTYPE, ");//
		sql.append("A.ATTNID, ");
		sql.append("A.INSERTUSERID, ");
		sql.append("A.LC_PRINTTIME, ");
		sql.append("A.CY_PRINTTIME, ");
		sql.append("A.PG_TIME, ");
		sql.append("A.PG_PRINTTIME, ");
		sql.append("A.DB_PRINTTIME, ");
		sql.append("A.GH_PRINTTIME, ");
		sql.append("A.ZY_PRINTTIME, ");
		sql.append("A.LZ_PRINTTIME, ");
		sql.append("A.XS_PRINTTIME, ");
		sql.append("A.INSERTTIME, ");
		sql.append("A.UPDATEUSERID, ");
		sql.append("A.UPDATETIME, ");
		sql.append("A.PRETRANSFER, ");
		sql.append("A.CHANGETRADETICKET, ");
		sql.append("A.REGISTRATION, ");
		sql.append("A.TRANSFERREGISTER, ");
		sql.append("A.CHANGESVACATE, ");
		sql.append("A.WAITFORSTATUS, ");
		sql.append("A.CHECKUSERID,  ");
		sql.append("A.PICCHANGENUM, ");
		sql.append("A.CHECKFILESTATUS, ");
		sql.append("A.MEMBERID, ");
		sql.append("A.ISMATCH, ");
		sql.append("A.MODELCODE, ");
		sql.append("A.VENDORCODE, ");
		sql.append("A.COUNTRYSTYLE, ");
		sql.append("A.CARTYPE, ");
		sql.append("A.CARUSE, ");
		sql.append("A.CARDTYPE, ");
		sql.append("A.REGISTERCARDNO, ");
		sql.append("A.CAROWNERIDCARDNO, ");
		sql.append("A.REGISTERCARDNO, ");
		sql.append("A.REGDATE, ");
		sql.append("A.ATTACHMEMBERID, ");
		sql.append("B.VAONAME, ");
		sql.append("C.REALNAME, ");
		sql.append("A.CHANGEBODY, ");
		sql.append("E.MARKETNAME ");
		sql.append("FROM ");
		sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A LEFT JOIN " + TmsTableNames.TMS_CITY + " B on(A.carMarketInCity = B.cityId)");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_CHECK_USER + " C ON (A.checkUserid = C.ID) ");
		sql.append(" LEFT JOIN " + TmsTableNames.TMS_TRANSMARKET_CODE + " E ON (A.transMarket = E.ID) ");
		sql.append("   WHERE 1=1 ");
		sql.append("   AND A.STATUS <> 16 "); // 过户完了
		sql.append("   AND A.STATUS <> 0 "); // 业务作废
		if (StringUtils.isNotEmpty(serial)) sql.append("   AND A.SERIAL =" + serial + " ");
		TransferAcceptedInfoDto dto = null;
		try {
			ps = conn.prepareStatement(sql.toString());
			rs = ps.executeQuery();
			if (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setId(rs.getInt("ID"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setCarType(rs.getString("CARTYPE"));
				dto.setMarketType(rs.getInt("MARKETTYPE"));
				dto.setBasicCarId(rs.getString("BASICCARID"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setVin(rs.getString("VIN"));
				dto.setCarClass(rs.getInt("CARCLASS"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
				dto.setRepeatVIN(rs.getInt("REPEATVIN"));
				dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
				dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
				dto.setCarMarketInCity(rs.getInt("CARMARKETINCITY"));
				dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
				dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
				dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
				dto.setOther(rs.getInt("OTHER"));
				dto.setVinNum(rs.getString("VINNUM"));
				dto.setEngineNum(rs.getString("ENGINENUM"));
				dto.setBrandModel(rs.getString("BRANDMODEL"));
				dto.setCy_color(rs.getString("CY_COLOR"));
				dto.setCy_passenger(rs.getString("CY_PASSENGER"));
				dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
				dto.setTireIntact(rs.getString("TIREINTACT"));
				dto.setSeatBelt(rs.getString("SEATBELT"));
				dto.setNumberAxes(rs.getString("NUMBERAXES"));
				dto.setTireSize(rs.getString("TIRESIZE"));
				dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
				dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
				dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
				dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
				dto.setSecurity(rs.getString("SECURITY"));
				dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
				dto.setSiren(rs.getString("SIREN"));
				dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
				dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setPhoto_2(rs.getString("PHOTO_2"));
				dto.setPhoto_3(rs.getString("PHOTO_3"));
				dto.setPhoto_4(rs.getString("PHOTO_4"));
				dto.setRemark(rs.getString("REMARK"));
				dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
				dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
				dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
				dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
				dto.setPg_price(rs.getInt("PG_PRICE"));
				dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
				dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
				dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
				dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
				dto.setOwnerType(rs.getInt("OWNERTYPE"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setOwnerPhone(rs.getString("OWNERPHONE"));
				dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
				dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
				dto.setAgentName(rs.getString("AGENTNAME"));
				dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
				dto.setAgentAddress(rs.getString("AGENTADDRESS"));
				dto.setAgentPhone(rs.getString("AGENTPHONE"));
				dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
				dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
				dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
				dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
				dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
				dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
				dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
				dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
				dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
				dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
				dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
				dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
				dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
				dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
				dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
				dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
				dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
				dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
				dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
				dto.setMaterialImages6(rs.getString("MATERIALIMAGES6"));
				dto.setMaterialImages7(rs.getString("MATERIALIMAGES7"));
				dto.setMaterialImages8(rs.getString("MATERIALIMAGES8"));
				dto.setMaterialImages9(rs.getString("MATERIALIMAGES9"));
				dto.setMaterialImages10(rs.getString("MATERIALIMAGES10"));
				dto.setPrice(rs.getInt("PRICE"));
				dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
				dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
				dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
				dto.setSourceType(rs.getInt("SOURCETYPE"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
				dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
				dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
				dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
				dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
				dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
				dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
				dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
				dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
				dto.setTransferType(rs.getInt("TRANSFERTYPE"));
				dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
				dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
				dto.setTaxNo(rs.getString("TAXNO"));
				dto.setTransNo(rs.getString("TRANSNO"));
				dto.setTransMarket(rs.getString("TRANSMARKET"));
				dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
				dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
				dto.setGainType(rs.getInt("GAINTYPE"));
				dto.setAttnId(rs.getString("ATTNID"));
				dto.setInsertUserid(rs.getInt("INSERTUSERID"));
				dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
				dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
				dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
				dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
				dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
				dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
				dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
				dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
				dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
				dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
				dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
				dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
				dto.setUpdateTime(rs.getDate("UPDATETIME"));
				dto.setPreTransfer(rs.getInt("PRETRANSFER"));
				dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
				dto.setRegistration(rs.getInt("REGISTRATION"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
				dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
				dto.setCheckUserid(rs.getInt("CHECKUSERID"));
				dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
				dto.setMemberId(rs.getString("MEMBERID"));
				dto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS"));
				dto.setMemberRealName(rs.getString("REALNAME"));
				dto.setIsMatch(rs.getInt("ISMATCH"));
				dto.setModelCode(rs.getString("MODELCODE"));
				dto.setVendorCode(rs.getString("VENDORCODE"));
				dto.setCarType(rs.getString("CARTYPE"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setCarUse(rs.getString("CARUSE"));
				dto.setCountryStyle(rs.getString("COUNTRYSTYLE"));
				dto.setRegisterCardNo(rs.getString("REGISTERCARDNO"));
				dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
				dto.setRegDate(rs.getTimestamp("REGDATE"));
				dto.setAttachMemberId(rs.getString("ATTACHMEMBERID"));
				dto.setVaoName(rs.getString("vaoName"));
				dto.setRealName(rs.getString("realName"));
				dto.setChangeBody(rs.getInt("CHANGEBODY"));
				dto.setMarketName(rs.getString("MARKETNAME"));
				//
//				TmsConfigureDao dao = (TmsConfigureDao) TmsDao.getInstance(TmsDao.TMS_CONFIGURE);
//				String maketNo = dao.getConfig("maketNo");
//				if(maketNo != null) {
//					TransMarketCodeDao market = (TransMarketCodeDao) TmsDao.getInstance(TmsDao.TMS_TRANSMARKET_CODE);
//					TransMarketCodeDto marketDto = market.getTransMarketCodeInfo(maketNo);
//					if(marketDto != null) dto.setMarketName(marketDto.getMarketName());
//				}
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}

		return dto;
	}

	
	@Override
	public void updateAcceptInfo001(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		String carOwner = dto.getCarOwner();
		String newCarOwner = dto.getNewcarOwner();
		try {
			StringBuffer sql = new StringBuffer("UPDATE  ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" transmarket=?,  ");
			sql.append(" carOwnerIdCardNo=?,  ");
			sql.append(" newCarOwnerIdCardNo=?,  ");
			sql.append(" transNo=?,  ");
			sql.append(" vendorCode=?,  ");
			sql.append(" modelCode=?,  ");
			sql.append(" carType=?,  ");
			sql.append(" carUse=?,  ");
			sql.append(" registerCardNo=?,  ");
			sql.append(" carMarketInProv=?,  ");
			sql.append(" carMarketInCity=?,  ");
			sql.append(" price=?,  ");
			sql.append(" checkUserid=?,  ");
			if(StringUtils.isNotEmpty(carOwner) && carOwner.length()>=5) {
				sql.append(" ownerType=2,  ");
			} else {
				sql.append(" ownerType=1,  ");
			}
			sql.append(" carOwner=?,  ");
			sql.append(" ownerPhone=?,  ");
			sql.append(" ownerAddress=?,  ");
			if(StringUtils.isNotEmpty(newCarOwner) && newCarOwner.length()>=5) {
				sql.append(" newOwnerType=2,   ");
			} else {
				sql.append(" newOwnerType=1,   ");
			}
			sql.append(" newCarOwner=?,   ");
			sql.append(" newOwnerPhone=?,   ");
			sql.append(" newOwnerAddress=?,   ");
			if(dto.getChangeTradeTicket() == 2 && dto.getChangeBody() == 1) sql.append(" status=12,   ");
			if(dto.getChangeTradeTicket() == 2 && dto.getChangeBody() == 2) sql.append(" status=10,   ");
			if(dto.getChangeTradeTicket() == 1) {
				sql.append(" changeTradeTicket=2,   ");
				sql.append(" pg_printNum=2,   ");
				sql.append(" pg_printUserId=2,   ");
				sql.append(" other=2,   ");
				sql.append(" monitoringSales=2,   ");
			}
			sql.append(" gh_printTime=now(),   ");
			sql.append(" updateTime=now(),   ");
			sql.append(" updateUserId=? ,  ");
			if(StringUtils.isNotEmpty(carOwner) && carOwner.length()>=5) {
				sql.append(" ownerOrgNo=? ,  ");
			} else {
				sql.append(" carOwnerIdCardNo=?,   ");
			}
			if(StringUtils.isNotEmpty(newCarOwner) && newCarOwner.length()>=5) {
				sql.append(" newOwnerOrgNo=?  ");
			} else {
				sql.append(" newCarOwnerIdCardNo=?   ");
			}
			sql.append(" WHERE SERIAL =?  ");
			ps = conn.prepareStatement(sql.toString());
			int i =0;
			ps.setString(++i, dto.getTransMarket());
			ps.setString(++i, dto.getCarOwnerIdCardNo());
			ps.setString(++i, dto.getNewcarOwnerIdCardNo());
			ps.setString(++i, dto.getTransNo());
			ps.setString(++i, dto.getVendorCode());
			ps.setString(++i, dto.getModelCode());
			ps.setString(++i, dto.getCarType());
			ps.setString(++i, dto.getCarUse());
			ps.setString(++i, dto.getRegisterCardNo());
			ps.setInt(++i, dto.getCarMarketInProv());
			ps.setInt(++i, dto.getCarMarketInCity());
			ps.setInt(++i, dto.getPrice());
			ps.setInt(++i, dto.getCheckUserid());
			ps.setString(++i, dto.getCarOwner());
			ps.setString(++i, dto.getOwnerPhone());
			ps.setString(++i, dto.getOwnerAddress());
			ps.setString(++i, dto.getNewcarOwner());
			ps.setString(++i, dto.getNewOwnerPhone());
			ps.setString(++i, dto.getNewOwnerAddress());
			ps.setInt(++i, dto.getUpdateUserId());
			ps.setString(++i, dto.getCardNo());
			ps.setString(++i, dto.getNewCardNo());
			ps.setString(++i, dto.getSerial());
			ps.executeUpdate();

		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	@Override
	public void updateAcceptInfo002(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" STATUS=?,");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" UPDATETIME=SYSDATE() ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getStatus());
			ps.setInt(2, dto.getUpdateUserId());
			ps.setString(3, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}

	public String getTransferReason(String serial) throws TmsDaoException {
		String r = "";
		ResultSet rs = null;
		PreparedStatement ps = null;
		try {
			StringBuffer sql = new StringBuffer("SELECT REASON FROM " + TmsTableNames.TMS_TRANSFER_PROCESS_HISTORY);
			sql.append(" WHERE 1=1");
			sql.append(" AND BUSINESSTYPE in (20,22) " );
			sql.append(" AND SERIAL = " + serial);
			sql.append(" ORDER BY INSERTTIME DESC LIMIT 1");
			logger.info("get reason sql:" +  sql.toString());
			ps = conn.prepareStatement(sql.toString());

			rs = ps.executeQuery();
			while (rs.next()) {
				r = rs.getString("REASON");
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}
	
	@Override
	public List<TransferAcceptedInfoDto> getTransfers(String serial, String vin, String licensePlate) throws TmsDaoException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		TransferAcceptedInfoDto dto = null;
		List<TransferAcceptedInfoDto> r = new ArrayList<TransferAcceptedInfoDto>();
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("A.VIN,");
			sql.append("A.SERIAL,");
			sql.append("A.STATUS,");
			sql.append("A.CAROWNER");
			sql.append("A.PHOTO_1,");
			sql.append("A.TRANSFER,");
			sql.append("A.CY_CARDTYPE,");
			sql.append("A.LICENSEPLATE,");
			sql.append("A.NEWLICENSEPLATE,");
			sql.append("A.TRANSFERREGISTER,");
			sql.append("DATE_FORMAT(A.CHECKFILETIME,'%Y-%m-%d %H:%i') AS CHECKFILETIME,");
			sql.append("DATE_FORMAT(A.INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
			sql.append(" WHERE 1=1 ");
			if (!StringUtils.isEmpty(vin)) {
				sql.append(" AND A.VIN LIKE '%" + vin + "%'");
			}
			if (!StringUtils.isEmpty(serial)) {
				sql.append(" AND A.SERIAL LIKE '%" + serial + "%'");
			}
			if (!StringUtils.isEmpty(licensePlate) && !StringUtils.equals(licensePlate, LicensePlateConfigConstant.defLicensePlate)) {
				sql.append(" AND A.LICENSEPLATE LIKE '%" + licensePlate + "%'");
			}
			
			sql.append(" ORDER BY A.INSERTTIME DESC  ");

			logger.info("advance search sql:" +  sql.toString());
			ps = conn.prepareStatement(sql.toString());

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setVin(rs.getString("VIN"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setCarOwner(rs.getString("CAROWNER"));
				dto.setCardType(rs.getInt("CY_CARDTYPE"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setAttnName(rs.getString("ATTNNAME"));
				dto.setRealName(rs.getString("REALNAME"));
				dto.setCheckFileTimeS(rs.getString("CHECKFILETIME"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				r.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}

	@Override
	public List<TransferAcceptedInfoDto> getAllTransfers(String serial, String vin, String licensePlate) throws TmsDaoException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		TransferAcceptedInfoDto dto = null;
		List<TransferAcceptedInfoDto> r = new ArrayList<TransferAcceptedInfoDto>();
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("A.VIN,");
			sql.append("A.SERIAL,");
			sql.append("A.STATUS,");
			sql.append("A.PHOTO_1,");
			sql.append("A.TRANSFER,");
			sql.append("A.CARDTYPE,");
			sql.append("A.LICENSEPLATE,");
			sql.append("A.NEWLICENSEPLATE,");
			sql.append("A.TRANSFERREGISTER,");
			sql.append("DATE_FORMAT(A.CHECKFILETIME,'%Y-%m-%d %H:%i') AS CHECKFILETIME,");
			sql.append("DATE_FORMAT(A.INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append("T.ATTNNAME,");
			sql.append("U.REALNAME");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " T ON(T.ATTNID = A.ATTNID) ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_USER + " U ON(U.ID = A.INSERTUSERID) ");
			sql.append(" WHERE 1=1 ");
			if (!StringUtils.isEmpty(vin)) {
				sql.append(" AND A.VIN LIKE '%" + vin + "%'");
			}
			if (!StringUtils.isEmpty(serial)) {
				sql.append(" AND A.SERIAL LIKE '%" + serial + "%'");
			}
			if (!StringUtils.isEmpty(licensePlate) && !StringUtils.equals(licensePlate, LicensePlateConfigConstant.defLicensePlate)) {
				sql.append(" AND A.LICENSEPLATE LIKE '%" + licensePlate + "%'");
			}
			sql.append(" AND ( (A.STATUS in(1, 2, 5, 10, 11, 12) AND A.WAITFORSTATUS = 0) ");
			sql.append(" OR (A.STATUS=16 AND TIMESTAMPDIFF(DAY,A.UPDATETIME,SYSDATE()) < 30) )");
			if (!StringUtils.isEmpty(vin)) {
				sql.append(" ORDER BY VIN ASC  ");
			}
			if (!StringUtils.isEmpty(serial)) {
				sql.append(" ORDER BY SERIAL ASC  ");
			}
			if (!StringUtils.isEmpty(licensePlate) && !StringUtils.equals(licensePlate, LicensePlateConfigConstant.defLicensePlate)) {
				sql.append(" ORDER BY LICENSEPLATE ASC  ");
			}

			ps = conn.prepareStatement(getSql(sql.toString()));

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setVin(rs.getString("VIN"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setAttnName(rs.getString("ATTNNAME"));
				dto.setRealName(rs.getString("REALNAME"));
				dto.setCheckFileTimeS(rs.getString("CHECKFILETIME"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				r.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}
	
	@Override
	public List<TransferAcceptedInfoDto> getAllTransfers(String serial, String vin, String licensePlate, String loginId) throws TmsDaoException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		TransferAcceptedInfoDto dto = null;
		List<TransferAcceptedInfoDto> r = new ArrayList<TransferAcceptedInfoDto>();
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("A.VIN,");
			sql.append("A.SERIAL,");
			sql.append("A.STATUS,");
			sql.append("A.PHOTO_1,");
			sql.append("A.TRANSFER,");
			sql.append("A.CARDTYPE,");
			sql.append("A.LICENSEPLATE,");
			sql.append("A.NEWLICENSEPLATE,");
			sql.append("A.TRANSFERREGISTER,");
			sql.append("DATE_FORMAT(A.CHECKFILETIME,'%Y-%m-%d %H:%i') AS CHECKFILETIME,");
			sql.append("DATE_FORMAT(A.INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append("T.ATTNNAME,");
			sql.append("U.REALNAME");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " T ON(T.ATTNID = A.ATTNID) ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_USER + " U ON(U.ID = A.INSERTUSERID) ");
			sql.append(" WHERE 1=1 ");
			if (!StringUtils.isEmpty(vin)) {
				sql.append(" AND A.VIN LIKE '%" + vin + "%'");
			}
			if (!StringUtils.isEmpty(serial)) {
				sql.append(" AND A.SERIAL LIKE '%" + serial + "%'");
			}
			if (!StringUtils.isEmpty(licensePlate) && !StringUtils.equals(licensePlate, LicensePlateConfigConstant.defLicensePlate)) {
				sql.append(" AND A.LICENSEPLATE LIKE '%" + licensePlate + "%'");
			}
			sql.append(" AND ( (A.STATUS in(1, 2, 5, 10, 11, 12) AND A.WAITFORSTATUS = 0) ");
			sql.append(" OR (A.STATUS=16 AND TIMESTAMPDIFF(DAY,A.UPDATETIME,SYSDATE()) < 30) )");
			sql.append(" AND A.INSERTUSERID in( SELECT ID FROM " + TmsTableNames.TMS_USER + " WHERE USERID in (");
			sql.append(" SELECT USERID FROM " + TmsTableNames.TMS_ATTN);
			sql.append(" WHERE MEMBERID = ( SELECT MEMBERID FROM " + TmsTableNames.TMS_MEMBER + " WHERE USERID='" + loginId + "')");
			sql.append(" ))");
			if (!StringUtils.isEmpty(vin)) {
				sql.append(" ORDER BY VIN ASC  ");
			}
			if (!StringUtils.isEmpty(serial)) {
				sql.append(" ORDER BY SERIAL ASC  ");
			}
			if (!StringUtils.isEmpty(licensePlate) && !StringUtils.equals(licensePlate, LicensePlateConfigConstant.defLicensePlate)) {
				sql.append(" ORDER BY LICENSEPLATE ASC  ");
			}

			ps = conn.prepareStatement(getSql(sql.toString()));

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setVin(rs.getString("VIN"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setAttnName(rs.getString("ATTNNAME"));
				dto.setRealName(rs.getString("REALNAME"));
				dto.setCheckFileTimeS(rs.getString("CHECKFILETIME"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				r.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}
	
	@Override
	public List<TransferAcceptedInfoDto> getAuditingTransfers() throws TmsDaoException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		TransferAcceptedInfoDto dto = null;
		List<TransferAcceptedInfoDto> r = new ArrayList<TransferAcceptedInfoDto>();
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("A.VIN,");
			sql.append("A.SERIAL,");
			sql.append("A.STATUS,");
			sql.append("A.PHOTO_1,");
			sql.append("A.TRANSFER,");
			sql.append("A.CARDTYPE,");
			sql.append("A.LICENSEPLATE,");
			sql.append("A.NEWLICENSEPLATE,");
			sql.append("A.TRANSFERREGISTER,");
			sql.append("DATE_FORMAT(A.CHECKFILETIME,'%Y-%m-%d %H:%i') AS CHECKFILETIME,");
			sql.append("DATE_FORMAT(A.INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append("T.ATTNNAME,");
			sql.append("U.REALNAME");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " T ON(T.ATTNID = A.ATTNID) ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_USER + " U ON(U.ID = A.INSERTUSERID) ");
			sql.append(" WHERE 1=1 ");
			sql.append(" AND ((A.STATUS in(10,11) AND A.WAITFORSTATUS = 0) OR A.STATUS =12 )");
			sql.append(" ORDER BY INSERTTIME DESC  ");

			ps = conn.prepareStatement(getSql(sql.toString()));

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setVin(rs.getString("VIN"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setAttnName(rs.getString("ATTNNAME"));
				dto.setRealName(rs.getString("REALNAME"));
				dto.setCheckFileTimeS(rs.getString("CHECKFILETIME"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				r.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}

	@Override
	public List<TransferAcceptedInfoDto> getAuditingTransfers(String loginId) throws TmsDaoException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		TransferAcceptedInfoDto dto = null;
		List<TransferAcceptedInfoDto> r = new ArrayList<TransferAcceptedInfoDto>();
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("A.VIN,");
			sql.append("A.SERIAL,");
			sql.append("A.STATUS,");
			sql.append("A.PHOTO_1,");
			sql.append("A.TRANSFER,");
			sql.append("A.CARDTYPE,");
			sql.append("A.LICENSEPLATE,");
			sql.append("A.NEWLICENSEPLATE,");
			sql.append("A.TRANSFERREGISTER,");
			sql.append("DATE_FORMAT(A.CHECKFILETIME,'%Y-%m-%d %H:%i') AS CHECKFILETIME,");
			sql.append("DATE_FORMAT(A.INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append("T.ATTNNAME,");
			sql.append("U.REALNAME");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " T ON(T.ATTNID = A.ATTNID) ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_USER + " U ON(U.ID = A.INSERTUSERID) ");
			sql.append(" WHERE 1=1 ");
			sql.append(" AND ((A.STATUS in(10,11) AND A.WAITFORSTATUS = 0) OR A.STATUS = 12)");
			sql.append(" AND A.INSERTUSERID in( SELECT ID FROM " + TmsTableNames.TMS_USER + " WHERE USERID in (");
			sql.append(" SELECT USERID FROM " + TmsTableNames.TMS_ATTN);
			sql.append(" WHERE MEMBERID = ( SELECT MEMBERID FROM " + TmsTableNames.TMS_MEMBER + " WHERE USERID='" + loginId + "')");
			sql.append(" ))");
			sql.append(" ORDER BY INSERTTIME DESC  ");

			ps = conn.prepareStatement(getSql(sql.toString()));

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setVin(rs.getString("VIN"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setAttnName(rs.getString("ATTNNAME"));
				dto.setRealName(rs.getString("REALNAME"));
				dto.setCheckFileTimeS(rs.getString("CHECKFILETIME"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				r.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}

	@Override
	public List<TransferAcceptedInfoDto> getProcessingTransfers() throws TmsDaoException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		TransferAcceptedInfoDto dto = null;
		List<TransferAcceptedInfoDto> r = new ArrayList<TransferAcceptedInfoDto>();
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("A.VIN,");
			sql.append("A.SERIAL,");
			sql.append("A.STATUS,");
			sql.append("A.PHOTO_1,");
			sql.append("A.TRANSFER,");
			sql.append("A.CARDTYPE,");
			sql.append("A.LICENSEPLATE,");
			sql.append("A.NEWLICENSEPLATE,");
			sql.append("A.TRANSFERREGISTER,");
			sql.append("DATE_FORMAT(A.INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append("T.ATTNNAME,");
			sql.append("U.REALNAME");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " T ON(T.ATTNID = A.ATTNID) ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_USER + " U ON(U.ID = A.INSERTUSERID) ");
			sql.append(" WHERE 1=1 ");
			sql.append(" AND A.STATUS in(1,2) AND A.WAITFORSTATUS = 0");
			sql.append(" ORDER BY INSERTTIME DESC  ");

			ps = conn.prepareStatement(getSql(sql.toString()));

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setVin(rs.getString("VIN"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setAttnName(rs.getString("ATTNNAME"));
				dto.setRealName(rs.getString("REALNAME"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				r.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}
	
	@Override
	public List<TransferAcceptedInfoDto> getProcessingTransfers(String loginId) throws TmsDaoException {
		ResultSet rs = null;
		PreparedStatement ps = null;
		TransferAcceptedInfoDto dto = null;
		List<TransferAcceptedInfoDto> r = new ArrayList<TransferAcceptedInfoDto>();
		try {
			StringBuffer sql = new StringBuffer("SELECT ");
			sql.append("A.VIN,");
			sql.append("A.SERIAL,");
			sql.append("A.STATUS,");
			sql.append("A.PHOTO_1,");
			sql.append("A.TRANSFER,");
			sql.append("A.CARDTYPE,");
			sql.append("A.LICENSEPLATE,");
			sql.append("A.NEWLICENSEPLATE,");
			sql.append("A.TRANSFERREGISTER,");
			sql.append("DATE_FORMAT(A.INSERTTIME,'%Y-%m-%d %H:%i') AS INSERTTIME,");
			sql.append("T.ATTNNAME,");
			sql.append("U.REALNAME");
			sql.append(" FROM ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO).append(" A ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " T ON(T.ATTNID = A.ATTNID) ");
			sql.append(" LEFT JOIN " + TmsTableNames.TMS_USER + " U ON(U.ID = A.INSERTUSERID) ");
			sql.append(" WHERE 1=1 ");
			sql.append(" AND A.STATUS in(1,2) AND A.WAITFORSTATUS = 0");
			sql.append(" AND A.INSERTUSERID in( SELECT ID FROM " + TmsTableNames.TMS_USER + " WHERE USERID in (");
			sql.append(" SELECT USERID FROM " + TmsTableNames.TMS_ATTN);
			sql.append(" WHERE MEMBERID = ( SELECT MEMBERID FROM " + TmsTableNames.TMS_MEMBER + " WHERE USERID='" + loginId + "')");
			sql.append(" ))");
			sql.append(" ORDER BY INSERTTIME DESC  ");

			ps = conn.prepareStatement(getSql(sql.toString()));

			rs = ps.executeQuery();
			while (rs.next()) {
				dto = new TransferAcceptedInfoDto();
				dto.setVin(rs.getString("VIN"));
				dto.setSerial(rs.getString("SERIAL"));
				dto.setStatus(rs.getInt("STATUS"));
				dto.setPhoto_1(rs.getString("PHOTO_1"));
				dto.setCardType(rs.getInt("CARDTYPE"));
				dto.setLicensePlate(rs.getString("LICENSEPLATE"));
				dto.setNewLicensePlate(rs.getString("NEWLICENSEPLATE"));
				dto.setInsertTimeS(rs.getString("INSERTTIME"));
				dto.setAttnName(rs.getString("ATTNNAME"));
				dto.setRealName(rs.getString("REALNAME"));
				dto.setTransfer(rs.getInt("TRANSFER"));
				dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
				r.add(dto);
			}
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());

		} finally {
			super.close(rs, ps);
		}
		return r;
	}
	
	
	@Override
	public void updateAcceptInfo003(TransferAcceptedInfoDto dto) throws TmsDaoException {
		PreparedStatement ps = null;
		ResultSet rs = null;
		try {
			StringBuffer sql = new StringBuffer("UPDATE ");
			sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
			sql.append(" SET  ");
			sql.append(" STATUS=0,");
			sql.append(" CHANGEUSENATURE=?,");
			sql.append(" UPDATEUSERID=?,  ");
			sql.append(" acceptedTime=SYSDATE(),  ");
			sql.append(" UPDATETIME=SYSDATE() ");
			sql.append(" WHERE ");
			sql.append(" SERIAL=?");
			ps = conn.prepareStatement(sql.toString());
			ps.setInt(1, dto.getChangeUsenature());
			ps.setInt(2, dto.getUpdateUserId());
			ps.setString(3, dto.getSerial());
			ps.executeUpdate();
		} catch (SQLException e) {
			throw new TmsDaoException(e.toString());
		} finally {
			super.close(rs, ps);
		}
	}
	
	public boolean isSameMemberIdBetweenAttnAndCar(String userId,String serial,String licensePlate) throws TmsDaoException {
	    boolean rtn = false;
	    PreparedStatement ps = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer("");
        sql.append("   SELECT     ");
        sql.append("       shuju.*    ");
        sql.append("      FROM       ");
        sql.append("       tms_member shanghu,   ");
        sql.append("       tms_attn jingjiren,        ");
        sql.append("       tms_user yonghu,     ");
        sql.append("       tms_transfer_accepted_info shuju    ");
        sql.append("      WHERE       ");
        sql.append("          shuju.insertUserid=yonghu.id   ");
        sql.append("      and shanghu.memberId=jingjiren.memberId    ");
        sql.append("      AND jingjiren.userId=yonghu.userId    ");
        sql.append("   AND shanghu.userId ='" + userId + "' ");
        if(serial!=null && !"".equals(serial)) 
        {
            sql.append("   AND shuju.SERIAL ='" + serial + "' ");
        }
        if(licensePlate!=null && !"".equals(licensePlate)) 
        {
            sql.append("   AND shuju.LICENSEPLATE ='" + licensePlate + "' ");
        }

        try {
            ps = conn.prepareStatement(sql.toString());
            rs = ps.executeQuery();
            rtn = rs.next();
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());

        } finally {
            super.close(rs, ps);
        }
	    return rtn;
	}
		/* 
	 *  更新“过户业务基本信息表 (tms_transfer_accepted_info)” 
	 *
	 */
    public void updateConformityMarkBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
        PreparedStatement ps = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer("UPDATE  ");
        sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
        sql.append(" SET  ");
        sql.append("conformityMark=?,");
        sql.append("updateUserId=?,");
        sql.append("updateTime=SYSDATE(),");
        sql.append("pg_Time=SYSDATE()");
        sql.append(" WHERE serial =?  ");
        try {
            ps = conn.prepareStatement(sql.toString());
            ps.setInt(1, dto.getConformityMark());
            ps.setInt(2, dto.getUpdateUserId());
            ps.setString(3, dto.getSerial());
            ps.executeUpdate();
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());
        } finally {
            super.close(rs, ps);
        }
    }

    @Override
    public void updateChangeTableBySerial(TransferAcceptedInfoDto dto)
            throws TmsDaoException {
        PreparedStatement ps = null;
        ResultSet rs = null;
        
        try {
            StringBuffer sql = new StringBuffer("UPDATE ");
            sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
            sql.append(" SET  ");
            sql.append(" changesvacate=?,");
            sql.append(" changecolor=?,");
            sql.append(" changeengine=?,");
            sql.append(" pg_printTime=sysdate(),");
            sql.append(" updatetime=sysdate(),");
            sql.append(" UPDATEUSERID=?");
            sql.append(" WHERE ");
            sql.append(" SERIAL=?");
            ps = conn.prepareStatement(sql.toString());
            ps.setInt(1, dto.getChangesVacate());
            ps.setInt(2, dto.getChangeColor());
            ps.setInt(3, dto.getChangeEngine());
            ps.setInt(4, dto.getUpdateUserId());
            ps.setString(5, dto.getSerial());
            ps.executeUpdate();
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());
        } finally {
            super.close(rs, ps);
        }   
    }

    @Override
    public List<TransferAcceptedInfoDto> getAcceptInfo(String serial,String licensePlate)
            throws TmsDaoException {
        // 开始掉数据
        PreparedStatement ps = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer("SELECT ");
        sql.append("A.ID, ");
        sql.append("A.SERIAL, ");
        sql.append("A.MARKETTYPE, ");
        sql.append("A.BASICCARID, ");
        sql.append("A.LICENSEPLATE, ");
        sql.append("A.VIN, ");
        sql.append("A.CY_CARDTYPE, ");
        sql.append("A.CARCLASS, ");
        sql.append("A.TRANSFER, ");
        sql.append("A.CHANGEUSENATURE, ");
        sql.append("A.REPEATVIN, ");
        sql.append("A.REPEATENGINENUM, ");
        sql.append("A.CHANGEALLCAR, ");
        sql.append("A.APPLYCERTIFICATE, ");
        sql.append("A.REPLACEMENTCERTIFICATE, ");
        sql.append("A.MONITORINGSALES, ");
        sql.append("A.OTHER, ");
        sql.append("A.VINNUM, ");
        sql.append("A.ENGINENUM, ");
        sql.append("A.BRANDMODEL, ");
        sql.append("A.CY_COLOR, ");
        sql.append("A.CY_PASSENGER, ");
        sql.append("A.CY_CARTYPE, ");
        sql.append("A.PLATEORTIREEXTERIOR, ");
        sql.append("A.TIREINTACT, ");
        sql.append("A.SEATBELT, ");
        sql.append("A.NUMBERAXES, ");
        sql.append("A.TIRESIZE, ");
        sql.append("A.LATERALPORTIONOF, ");
        sql.append("A.REFLECTIVEMARK, ");
        sql.append("A.FIREEXTINGUISHER, ");
        sql.append("A.DRIVINGRECORD, ");
        sql.append("A.SECURITY, ");
        sql.append("A.EXTERNALMARKING, ");
        sql.append("A.SIREN, ");
        sql.append("A.SECURITYTECHNOLOGY, ");
        sql.append("A.CHECKCONCLUSION, ");
        sql.append("A.PHOTO_1, ");
        sql.append("A.PHOTO_2, ");
        sql.append("A.PHOTO_3, ");
        sql.append("A.PHOTO_4, ");
        sql.append("A.REMARK, ");
        sql.append("A.LC_PRINTNUM, ");
        sql.append("A.LC_PRINTUSERID, ");
        sql.append("A.CY_PRINTNUM, ");
        sql.append("A.CY_PRINTUSERID, ");
        sql.append("A.PG_PRICE, ");
        sql.append("A.PG_PRINTNUM, ");
        sql.append("A.PG_PRINTUSERID, ");
        sql.append("A.DB_PRINTNUM, ");
        sql.append("A.DB_PRINTUSERID, ");
        sql.append("A.OWNERTYPE, ");
//        sql.append("D.ITEMVALUE AS OWNERTYPE, ");
        sql.append("A.CAROWNER, ");
        sql.append("A.CAROWNERIDCARDNO, ");
        sql.append("A.OWNERPHONE, ");
        sql.append("A.OWNERADDRESS, ");
        sql.append("A.OWNERORGNO, ");
        sql.append("A.AGENTNAME, ");
        sql.append("A.AGENTOWNERIDCARDNO, ");
        sql.append("A.AGENTADDRESS, ");
        sql.append("A.AGENTPHONE, ");
        sql.append("A.NEWOWNERTYPE, ");
        sql.append("A.NEWCAROWNER, ");
        sql.append("A.NEWCAROWNERIDCARDNO, ");
        sql.append("A.NEWOWNERPHONE, ");
        sql.append("A.NEWOWNERTELPHONE, ");
        sql.append("A.NEWOWNERADDRESS, ");
        sql.append("A.NEWOWNERORGNO, ");
        sql.append("A.NEWOWNERZIPCODE, ");
        sql.append("A.NEWOWNERMAILADDRESS, ");
        sql.append("A.NEWAGENTNAME, ");
        sql.append("A.NEWAGENTOWNERIDCARDNO, ");
        sql.append("A.NEWAGENTADDRESS, ");
        sql.append("A.NEWAGENTPHONE, ");
        sql.append("A.OWNERSGROUPPHOTO, ");
        sql.append("A.MATERIALIMAGES1, ");
        sql.append("A.MATERIALIMAGES2, ");
        sql.append("A.MATERIALIMAGES3, ");
        sql.append("A.MATERIALIMAGES4, ");
        sql.append("A.MATERIALIMAGES5, ");
        sql.append("A.PRICE, ");
        sql.append("A.TRANSFERPRICE, ");
        sql.append("A.EXTENDEDPRICE, ");
        sql.append("A.DOUBLETRANSFERPRICE, ");
        sql.append("A.SOURCETYPE, ");
        sql.append("A.STATUS, ");
        sql.append("A.AGENTTIME, ");
        sql.append("A.GH_PRINTNUM, ");
        sql.append("A.GH_PRINTUSERID, ");
        sql.append("A.ZY_PRINTNUM, ");
        sql.append("A.ZY_PRINTUSERID, ");
        sql.append("A.LZ_PRINTNUM, ");
        sql.append("A.LZ_PRINTUSERID, ");
        sql.append("A.XS_PRINTNUM, ");
        sql.append("A.XS_PRINTUSERID, ");
        sql.append("A.TRANSFERTYPE, ");
        sql.append("A.CARMARKETIN, ");
        sql.append("A.MOVEOUTPROVINCE, ");
        sql.append("A.MOVEOUTCITY, ");
        sql.append("A.TAXNO, ");
        sql.append("A.TRANSNO, ");
        sql.append("A.TRANSMARKET, ");
        sql.append("A.PAYMENTPEOPLE, ");
        sql.append("A.LICENSEACCEPTIME, ");
        sql.append("A.GAINTYPE, ");//           
        sql.append("A.ATTNID, ");
        sql.append("A.INSERTUSERID, ");
        sql.append("A.LC_PRINTTIME, ");
        sql.append("A.CY_PRINTTIME, ");
        sql.append("A.PG_TIME, ");
        sql.append("A.PG_PRINTTIME, ");
        sql.append("A.DB_PRINTTIME, ");
        sql.append("A.GH_PRINTTIME, ");
        sql.append("A.ZY_PRINTTIME, ");
        sql.append("A.LZ_PRINTTIME, ");
        sql.append("A.XS_PRINTTIME, ");
        sql.append("A.INSERTTIME, ");
        sql.append("A.UPDATEUSERID, ");
        sql.append("A.UPDATETIME, ");
        sql.append("A.PRETRANSFER, ");
        sql.append("A.CHANGETRADETICKET, ");
        sql.append("A.REGISTRATION, ");
        sql.append("A.TRANSFERREGISTER, ");
        sql.append("A.CHANGESVACATE, ");
        sql.append("A.WAITFORSTATUS, ");
        sql.append("A.CHECKUSERID,  ");
        sql.append("A.PICCHANGENUM, ");
        sql.append("A.CHECKFILESTATUS, ");
        sql.append("A.MEMBERID, ");
        sql.append("A.ISMATCH, ");
        sql.append("A.CARTYPE, ");
        // #131 start
        sql.append("A.CONFORMITYMARK,");
        sql.append("A.CHANGEENGINE, ");
        // #131 e n d
        sql.append("B.REALNAME, ");
        sql.append("C.TRANSFERPRICEDATE, ");
        sql.append("C.CHECKPRICEDATE ");
        sql.append("FROM ");
        sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO+" A" +" LEFT JOIN "+TmsTableNames.TMS_MEMBER+" B on(A.MEMBERID = B.MEMBERID)");
        sql.append(" LEFT JOIN "+TmsTableNames.TMS_TRANSFER_FINANCE_INFO+" C ON (A.SERIAL = C.SERIAL) ");
//        sql.append(" LEFT JOIN "+TmsTableNames.TMS_CODES+" D ON (D.itemCode = A.OWNERTYPE) AND ITEMID = '101' ");
        sql.append("   WHERE 1=1 ");
        sql.append("      AND A.STATUS NOT IN (0,16)  ");
        if(serial!=null && !"".equals(serial)) 
        {
            sql.append("   AND A.SERIAL =" + serial + " ");
        }
        if(licensePlate!=null && !"".equals(licensePlate)) 
        {
            sql.append("   AND A.LICENSEPLATE ='" + licensePlate + "' ");
        }
        sql.append(" ORDER BY A.INSERTTIME ASC  ");
        
        TransferAcceptedInfoDto dto = null;
        List<TransferAcceptedInfoDto> dtos = new ArrayList<TransferAcceptedInfoDto>();
        try {
            ps = conn.prepareStatement(sql.toString());
            rs = ps.executeQuery();
            while (rs.next()) {
                dto = new TransferAcceptedInfoDto();
                dto.setId(rs.getInt("ID"));
                dto.setSerial(rs.getString("SERIAL"));
                dto.setMarketType(rs.getInt("MARKETTYPE"));
                dto.setBasicCarId(rs.getString("BASICCARID"));
                dto.setLicensePlate(rs.getString("LICENSEPLATE"));
                dto.setVin(rs.getString("VIN"));
                dto.setCy_cardType(rs.getInt("CY_CARDTYPE"));
                dto.setCarClass(rs.getInt("CARCLASS"));
                dto.setTransfer(rs.getInt("TRANSFER"));
                dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
                dto.setRepeatVIN(rs.getInt("REPEATVIN"));
                dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
                dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
                dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
                dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
                dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
                dto.setOther(rs.getInt("OTHER"));
                dto.setVinNum(rs.getString("VINNUM"));
                dto.setEngineNum(rs.getString("ENGINENUM"));
                dto.setBrandModel(rs.getString("BRANDMODEL"));
                dto.setCy_color(rs.getString("CY_COLOR"));
                dto.setCy_passenger(rs.getString("CY_PASSENGER"));
                dto.setCy_carType(rs.getString("CY_CARTYPE"));
                dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
                dto.setTireIntact(rs.getString("TIREINTACT"));
                dto.setSeatBelt(rs.getString("SEATBELT"));
                dto.setNumberAxes(rs.getString("NUMBERAXES"));
                dto.setTireSize(rs.getString("TIRESIZE"));
                dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
                dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
                dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
                dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
                dto.setSecurity(rs.getString("SECURITY"));
                dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
                dto.setSiren(rs.getString("SIREN"));
                dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
                dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
                dto.setPhoto_1(rs.getString("PHOTO_1"));
                dto.setPhoto_2(rs.getString("PHOTO_2"));
                dto.setPhoto_3(rs.getString("PHOTO_3"));
                dto.setPhoto_4(rs.getString("PHOTO_4"));
                dto.setRemark(rs.getString("REMARK"));
                dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
                dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
                dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
                dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
                dto.setPg_price(rs.getInt("PG_PRICE"));
                dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
                dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
                dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
                dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
                dto.setOwnerType(rs.getInt("OWNERTYPE"));
                dto.setCarOwner(rs.getString("CAROWNER"));
                dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
                dto.setOwnerPhone(rs.getString("OWNERPHONE"));
                dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
                dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
                dto.setAgentName(rs.getString("AGENTNAME"));
                dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
                dto.setAgentAddress(rs.getString("AGENTADDRESS"));
                dto.setAgentPhone(rs.getString("AGENTPHONE"));
                dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
                dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
                dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
                dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
                dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
                dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
                dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
                dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
                dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
                dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
                dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
                dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
                dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
                dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
                dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
                dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
                dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
                dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
                dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
                dto.setPrice(rs.getInt("PRICE"));
                dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
                dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
                dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
                dto.setSourceType(rs.getInt("SOURCETYPE"));
                dto.setStatus(rs.getInt("STATUS"));
                dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
                dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
                dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
                dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
                dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
                dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
                dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
                dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
                dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
                dto.setTransferType(rs.getInt("TRANSFERTYPE"));
                dto.setCarMarketIn(rs.getString("CARMARKETIN"));
                dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
                dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
                dto.setTaxNo(rs.getString("TAXNO"));
                dto.setTransNo(rs.getString("TRANSNO"));
                dto.setTransMarket(rs.getString("TRANSMARKET"));
                dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
                dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
                dto.setGainType(rs.getInt("GAINTYPE"));
                dto.setAttnId(rs.getString("ATTNID"));
                dto.setInsertUserid(rs.getInt("INSERTUSERID"));
                dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
                dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
                dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
                dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
                dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
                dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
                dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
                dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
                dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
                dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
                dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
                dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
                dto.setUpdateTime(rs.getDate("UPDATETIME")); 
                dto.setPreTransfer(rs.getInt("PRETRANSFER")); 
                dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
                dto.setRegistration(rs.getInt("REGISTRATION"));
                dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
                dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
                dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
                dto.setCheckUserid(rs.getInt("CHECKUSERID")); 
                dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
                dto.setMemberId(rs.getString("MEMBERID")); //add by huangwei
                dto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS")); //add by huangheli
//                dto.setMemberRealName(rs.getString("REALNAME"));
//                dto.setTransferPriceDate(rs.getTimestamp("TRANSFERPRICEDATE"));
//                dto.setCheckPriceDate(rs.getTimestamp("CHECKPRICEDATE"));
                dto.setIsMatch(rs.getInt("ISMATCH"));
                dto.setCarType(rs.getString("CARTYPE"));
                // #131 start
                dto.setChangeEngine(rs.getInt("CHANGEENGINE"));
                dto.setConformityMark(rs.getInt("CONFORMITYMARK"));
                // #131 e n d
                dtos.add(dto);
            }
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());

        } finally {
            super.close(rs, ps);
        }
        return dtos;
    }
    

    @Override
    public TransferAcceptedInfoDto getAcceptInfoOnlyBySerial(String serial, String licensePlate) throws TmsDaoException {
        // 开始掉数据
        PreparedStatement ps = null;
        ResultSet rs = null;
        StringBuffer sql = new StringBuffer("SELECT ");
        sql.append("A.ID, ");
        sql.append("A.SERIAL, ");
        sql.append("A.MARKETTYPE, ");
        sql.append("A.BASICCARID, ");
        sql.append("A.LICENSEPLATE, ");
        sql.append("A.VIN, ");
        sql.append("A.CY_CARDTYPE, ");
        sql.append("A.CARCLASS, ");
        sql.append("A.TRANSFER, ");
        sql.append("A.CHANGEUSENATURE, ");
        sql.append("A.REPEATVIN, ");
        sql.append("A.REPEATENGINENUM, ");
        sql.append("A.CHANGEALLCAR, ");
        sql.append("A.APPLYCERTIFICATE, ");
        sql.append("A.REPLACEMENTCERTIFICATE, ");
        sql.append("A.MONITORINGSALES, ");
        sql.append("A.OTHER, ");
        sql.append("A.VINNUM, ");
        sql.append("A.ENGINENUM, ");
        sql.append("A.BRANDMODEL, ");
        sql.append("A.CY_COLOR, ");
        sql.append("A.CY_PASSENGER, ");
        sql.append("A.CY_CARTYPE, ");
        sql.append("A.PLATEORTIREEXTERIOR, ");
        sql.append("A.TIREINTACT, ");
        sql.append("A.SEATBELT, ");
        sql.append("A.NUMBERAXES, ");
        sql.append("A.TIRESIZE, ");
        sql.append("A.LATERALPORTIONOF, ");
        sql.append("A.REFLECTIVEMARK, ");
        sql.append("A.FIREEXTINGUISHER, ");
        sql.append("A.DRIVINGRECORD, ");
        sql.append("A.SECURITY, ");
        sql.append("A.EXTERNALMARKING, ");
        sql.append("A.SIREN, ");
        sql.append("A.SECURITYTECHNOLOGY, ");
        sql.append("A.CHECKCONCLUSION, ");
        sql.append("A.PHOTO_1, ");
        sql.append("A.PHOTO_2, ");
        sql.append("A.PHOTO_3, ");
        sql.append("A.PHOTO_4, ");
        sql.append("A.REMARK, ");
        sql.append("A.LC_PRINTNUM, ");
        sql.append("A.LC_PRINTUSERID, ");
        sql.append("A.CY_PRINTNUM, ");
        sql.append("A.CY_PRINTUSERID, ");
        sql.append("A.PG_PRICE, ");
        sql.append("A.PG_PRINTNUM, ");
        sql.append("A.PG_PRINTUSERID, ");
        sql.append("A.DB_PRINTNUM, ");
        sql.append("A.DB_PRINTUSERID, ");
        sql.append("A.OWNERTYPE, ");
        sql.append("A.CAROWNER, ");
        sql.append("A.CAROWNERIDCARDNO, ");
        sql.append("A.OWNERPHONE, ");
        sql.append("A.OWNERADDRESS, ");
        sql.append("A.OWNERORGNO, ");
        sql.append("A.AGENTNAME, ");
        sql.append("A.AGENTOWNERIDCARDNO, ");
        sql.append("A.AGENTADDRESS, ");
        sql.append("A.AGENTPHONE, ");
        sql.append("A.NEWOWNERTYPE, ");
        sql.append("A.NEWCAROWNER, ");
        sql.append("A.NEWCAROWNERIDCARDNO, ");
        sql.append("A.NEWOWNERPHONE, ");
        sql.append("A.NEWOWNERTELPHONE, ");
        sql.append("A.NEWOWNERADDRESS, ");
        sql.append("A.NEWOWNERORGNO, ");
        sql.append("A.NEWOWNERZIPCODE, ");
        sql.append("A.NEWOWNERMAILADDRESS, ");
        sql.append("A.NEWAGENTNAME, ");
        sql.append("A.NEWAGENTOWNERIDCARDNO, ");
        sql.append("A.NEWAGENTADDRESS, ");
        sql.append("A.NEWAGENTPHONE, ");
        sql.append("A.OWNERSGROUPPHOTO, ");
        sql.append("A.MATERIALIMAGES1, ");
        sql.append("A.MATERIALIMAGES2, ");
        sql.append("A.MATERIALIMAGES3, ");
        sql.append("A.MATERIALIMAGES4, ");
        sql.append("A.MATERIALIMAGES5, ");
        sql.append("A.PRICE, ");
        sql.append("A.TRANSFERPRICE, ");
        sql.append("A.EXTENDEDPRICE, ");
        sql.append("A.DOUBLETRANSFERPRICE, ");
        sql.append("A.SOURCETYPE, ");
        sql.append("A.STATUS, ");
        sql.append("A.AGENTTIME, ");
        sql.append("A.GH_PRINTNUM, ");
        sql.append("A.GH_PRINTUSERID, ");
        sql.append("A.ZY_PRINTNUM, ");
        sql.append("A.ZY_PRINTUSERID, ");
        sql.append("A.LZ_PRINTNUM, ");
        sql.append("A.LZ_PRINTUSERID, ");
        sql.append("A.XS_PRINTNUM, ");
        sql.append("A.XS_PRINTUSERID, ");
        sql.append("A.TRANSFERTYPE, ");
        sql.append("A.CARMARKETIN, ");
        sql.append("A.MOVEOUTPROVINCE, ");
        sql.append("A.MOVEOUTCITY, ");
        sql.append("A.TAXNO, ");
        sql.append("A.TRANSNO, ");
        sql.append("A.TRANSMARKET, ");
        sql.append("A.PAYMENTPEOPLE, ");
        sql.append("A.LICENSEACCEPTIME, ");
        sql.append("A.GAINTYPE, ");//
        sql.append("A.ATTNID, ");
        sql.append("A.INSERTUSERID, ");
        sql.append("A.LC_PRINTTIME, ");
        sql.append("A.CY_PRINTTIME, ");
        sql.append("A.PG_TIME, ");
        sql.append("A.PG_PRINTTIME, ");
        sql.append("A.DB_PRINTTIME, ");
        sql.append("A.GH_PRINTTIME, ");
        sql.append("A.ZY_PRINTTIME, ");
        sql.append("A.LZ_PRINTTIME, ");
        sql.append("A.XS_PRINTTIME, ");
        sql.append("A.INSERTTIME, ");
        sql.append("A.UPDATEUSERID, ");
        sql.append("A.UPDATETIME, ");
        sql.append("A.PRETRANSFER, ");
        sql.append("A.CHANGETRADETICKET, ");
        sql.append("A.REGISTRATION, ");
        sql.append("A.TRANSFERREGISTER, ");
        sql.append("A.CHANGESVACATE, ");
        sql.append("A.WAITFORSTATUS, ");
        sql.append("A.CHECKUSERID,  ");
        sql.append("A.PICCHANGENUM, ");
        sql.append("A.CHECKFILESTATUS, ");
        sql.append("A.MEMBERID, ");
        sql.append("A.ISMATCH, ");
        sql.append("A.CARDTYPE, ");
        sql.append("A.CHANGEENGINE, ");
        sql.append("A.CONFORMITYMARK,");
        sql.append("A.VENDORID ");
        sql.append("FROM ");
        sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A" );
        sql.append("   WHERE 1=1 ");
        if (serial != null && !"".equals(serial)) {
            sql.append("   AND A.SERIAL =" + serial + " ");
        }
        if (licensePlate != null && !"".equals(licensePlate)) {
            sql.append("   AND A.LICENSEPLATE ='" + licensePlate + "' ");
        }
        sql.append(" ORDER BY A.INSERTTIME ASC  ");

        TransferAcceptedInfoDto dto = null;
        try {
            ps = conn.prepareStatement(sql.toString());
            rs = ps.executeQuery();
            while (rs.next()) {
                dto = new TransferAcceptedInfoDto();
                dto.setId(rs.getInt("ID"));
                dto.setSerial(rs.getString("SERIAL"));
                dto.setMarketType(rs.getInt("MARKETTYPE"));
                dto.setBasicCarId(rs.getString("BASICCARID"));
                dto.setLicensePlate(rs.getString("LICENSEPLATE"));
                dto.setVin(rs.getString("VIN"));
                dto.setCardType(rs.getInt("CY_CARDTYPE"));
                dto.setCarClass(rs.getInt("CARCLASS"));
                dto.setTransfer(rs.getInt("TRANSFER"));
                dto.setChangeUsenature(rs.getInt("CHANGEUSENATURE"));
                dto.setRepeatVIN(rs.getInt("REPEATVIN"));
                dto.setRepeatEngineNum(rs.getInt("REPEATENGINENUM"));
                dto.setChangeAllCar(rs.getInt("CHANGEALLCAR"));
                dto.setApplyCertificate(rs.getInt("APPLYCERTIFICATE"));
                dto.setReplacementCertificate(rs.getInt("REPLACEMENTCERTIFICATE"));
                dto.setMonitoringSales(rs.getInt("MONITORINGSALES"));
                dto.setOther(rs.getInt("OTHER"));
                dto.setVinNum(rs.getString("VINNUM"));
                dto.setEngineNum(rs.getString("ENGINENUM"));
                dto.setBrandModel(rs.getString("BRANDMODEL"));
                dto.setCy_color(rs.getString("CY_COLOR"));
                dto.setCy_passenger(rs.getString("CY_PASSENGER"));
                dto.setCarType(rs.getString("CY_CARTYPE"));
                dto.setPlateOrTireExterior(rs.getString("PLATEORTIREEXTERIOR"));
                dto.setTireIntact(rs.getString("TIREINTACT"));
                dto.setSeatBelt(rs.getString("SEATBELT"));
                dto.setNumberAxes(rs.getString("NUMBERAXES"));
                dto.setTireSize(rs.getString("TIRESIZE"));
                dto.setLateralPortionOf(rs.getString("LATERALPORTIONOF"));
                dto.setReflectiveMark(rs.getString("REFLECTIVEMARK"));
                dto.setFireExtinguisher(rs.getString("FIREEXTINGUISHER"));
                dto.setDrivingRecord(rs.getString("DRIVINGRECORD"));
                dto.setSecurity(rs.getString("SECURITY"));
                dto.setExternalMarking(rs.getString("EXTERNALMARKING"));
                dto.setSiren(rs.getString("SIREN"));
                dto.setSecurityTechnology(rs.getString("SECURITYTECHNOLOGY"));
                dto.setCheckConclusion(rs.getString("CHECKCONCLUSION"));
                dto.setPhoto_1(rs.getString("PHOTO_1"));
                dto.setPhoto_2(rs.getString("PHOTO_2"));
                dto.setPhoto_3(rs.getString("PHOTO_3"));
                dto.setPhoto_4(rs.getString("PHOTO_4"));
                dto.setRemark(rs.getString("REMARK"));
                dto.setLc_printNum(rs.getInt("LC_PRINTNUM"));
                dto.setLc_printUserId(rs.getInt("LC_PRINTUSERID"));
                dto.setCy_printNum(rs.getInt("CY_PRINTNUM"));
                dto.setCy_printUserId(rs.getInt("CY_PRINTUSERID"));
                dto.setPg_price(rs.getInt("PG_PRICE"));
                dto.setPg_printNum(rs.getInt("PG_PRINTNUM"));
                dto.setPg_printUserId(rs.getInt("PG_PRINTUSERID"));
                dto.setDb_printNum(rs.getInt("DB_PRINTNUM"));
                dto.setDb_printUserId(rs.getInt("DB_PRINTUSERID"));
                dto.setOwnerType(rs.getInt("OWNERTYPE"));
                dto.setCarOwner(rs.getString("CAROWNER"));
                dto.setCarOwnerIdCardNo(rs.getString("CAROWNERIDCARDNO"));
                dto.setOwnerPhone(rs.getString("OWNERPHONE"));
                dto.setOwnerAddress(rs.getString("OWNERADDRESS"));
                dto.setOwnerOrgNo(rs.getString("OWNERORGNO"));
                dto.setAgentName(rs.getString("AGENTNAME"));
                dto.setAgentOwnerIdCardNo(rs.getString("AGENTOWNERIDCARDNO"));
                dto.setAgentAddress(rs.getString("AGENTADDRESS"));
                dto.setAgentPhone(rs.getString("AGENTPHONE"));
                dto.setNewOwnerType(rs.getInt("NEWOWNERTYPE"));
                dto.setNewcarOwner(rs.getString("NEWCAROWNER"));
                dto.setNewcarOwnerIdCardNo(rs.getString("NEWCAROWNERIDCARDNO"));
                dto.setNewOwnerPhone(rs.getString("NEWOWNERPHONE"));
                dto.setNewOwnerTelPhone(rs.getString("NEWOWNERTELPHONE"));
                dto.setNewOwnerAddress(rs.getString("NEWOWNERADDRESS"));
                dto.setNewOwnerOrgNo(rs.getString("NEWOWNERORGNO"));
                dto.setNewOwnerZipCode(rs.getString("NEWOWNERZIPCODE"));
                dto.setNewOwnerMailAddress(rs.getString("NEWOWNERMAILADDRESS"));
                dto.setNewAgentName(rs.getString("NEWAGENTNAME"));
                dto.setNewAgentOwnerIdCardNo(rs.getString("NEWAGENTOWNERIDCARDNO"));
                dto.setNewAgentAddress(rs.getString("NEWAGENTADDRESS"));
                dto.setNewAgentPhone(rs.getString("NEWAGENTPHONE"));
                dto.setOwnersGroupPhoto(rs.getString("OWNERSGROUPPHOTO"));
                dto.setMaterialImages1(rs.getString("MATERIALIMAGES1"));
                dto.setMaterialImages2(rs.getString("MATERIALIMAGES2"));
                dto.setMaterialImages3(rs.getString("MATERIALIMAGES3"));
                dto.setMaterialImages4(rs.getString("MATERIALIMAGES4"));
                dto.setMaterialImages5(rs.getString("MATERIALIMAGES5"));
                dto.setPrice(rs.getInt("PRICE"));
                dto.setTransferPrice(rs.getInt("TRANSFERPRICE"));
                dto.setExtendedPrice(rs.getInt("EXTENDEDPRICE"));
                dto.setDoubleTransferPrice(rs.getInt("DOUBLETRANSFERPRICE"));
                dto.setSourceType(rs.getInt("SOURCETYPE"));
                dto.setStatus(rs.getInt("STATUS"));
                dto.setAgentTime(rs.getTimestamp("AGENTTIME"));
                dto.setGh_printnum(rs.getInt("GH_PRINTNUM"));
                dto.setGh_printUserId(rs.getInt("GH_PRINTUSERID"));
                dto.setZy_printnum(rs.getInt("ZY_PRINTNUM"));
                dto.setZy_printUserId(rs.getInt("ZY_PRINTUSERID"));
                dto.setLz_printnum(rs.getInt("LZ_PRINTNUM"));
                dto.setLz_printUserId(rs.getInt("LZ_PRINTUSERID"));
                dto.setXs_printnum(rs.getInt("XS_PRINTNUM"));
                dto.setXs_printUserId(rs.getInt("XS_PRINTUSERID"));
                dto.setTransferType(rs.getInt("TRANSFERTYPE"));
                dto.setCarMarketIn(rs.getString("CARMARKETIN"));
                dto.setMoveOutProvince(rs.getString("MOVEOUTPROVINCE"));
                dto.setMoveOutCity(rs.getString("MOVEOUTCITY"));
                dto.setTaxNo(rs.getString("TAXNO"));
                dto.setTransNo(rs.getString("TRANSNO"));
                dto.setTransMarket(rs.getString("TRANSMARKET"));
                dto.setPaymentPeople(rs.getString("PAYMENTPEOPLE"));
                dto.setLicenseAccepTime(rs.getTimestamp("LICENSEACCEPTIME"));
                dto.setGainType(rs.getInt("GAINTYPE"));
                dto.setAttnId(rs.getString("ATTNID"));
                dto.setInsertUserid(rs.getInt("INSERTUSERID"));
                dto.setInsertTimeS(DateUtil.getDateByTimeStamp(rs.getTimestamp("INSERTTIME")));
                dto.setInsertTime(rs.getTimestamp("INSERTTIME"));
                dto.setLc_printTime(rs.getTimestamp("LC_PRINTTIME"));
                dto.setCy_printTime(rs.getTimestamp("CY_PRINTTIME"));
                dto.setPg_time(DateUtil.getDateByTimeStamp(rs.getTimestamp("PG_TIME")));
                dto.setPg_printTime(rs.getTimestamp("PG_PRINTTIME"));
                dto.setDb_printTime(rs.getTimestamp("DB_PRINTTIME"));
                dto.setGh_printTime(rs.getTimestamp("GH_PRINTTIME"));
                dto.setZy_printTime(rs.getTimestamp("ZY_PRINTTIME"));
                dto.setLz_printTime(rs.getTimestamp("LZ_PRINTTIME"));
                dto.setXs_printTime(rs.getTimestamp("XS_PRINTTIME"));
                dto.setUpdateUserId(rs.getInt("UPDATEUSERID"));
                dto.setUpdateTime(rs.getDate("UPDATETIME"));
                dto.setPreTransfer(rs.getInt("PRETRANSFER"));
                dto.setChangeTradeTicket(rs.getInt("CHANGETRADETICKET"));
                dto.setRegistration(rs.getInt("REGISTRATION"));
                dto.setTransferRegister(rs.getInt("TRANSFERREGISTER"));
                dto.setChangesVacate(rs.getInt("CHANGESVACATE"));
                dto.setWaitForStatus(rs.getInt("WAITFORSTATUS"));
                dto.setCheckUserid(rs.getInt("CHECKUSERID"));
                dto.setPicChangeNum(rs.getInt("PICCHANGENUM"));
                dto.setMemberId(rs.getString("MEMBERID")); // add by huangwei
                dto.setCheckFileStatus(rs.getInt("CHECKFILESTATUS")); // add by
                                                                        // huangheli
                dto.setIsMatch(rs.getInt("ISMATCH"));
                dto.setVendorId(rs.getString("VENDORID"));
                dto.setChangeEngine(rs.getInt("CHANGEENGINE"));
                dto.setCardType(rs.getInt("CARDTYPE"));
                dto.setConformityMark(rs.getInt("CONFORMITYMARK"));
            }
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());

        } finally {
            super.close(rs, ps);
        }
        return dto;
    }

    @Override
    public void updateAcceptStatusToNewLicensePlateBySerial(TransferAcceptedInfoDto dto) throws TmsDaoException {
        PreparedStatement ps = null;
        ResultSet rs = null;

        try {
            StringBuffer sql = new StringBuffer("UPDATE ");
            sql.append(TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO);
            sql.append(" SET  ");
            sql.append(" STATUS=?,");
            if (dto.getLicensePlate() == null || !dto.getLicensePlate().equals(dto.getNewLicensePlate())) {
                sql.append(" licensePlate=?,");
                sql.append(" newLicensePlate=?,");
            }
            sql.append(" UPDATETIME=SYSDATE(),");
            sql.append(" lz_printTime=SYSDATE(), ");
            sql.append(" acceptedTime=SYSDATE(), ");
            sql.append(" updateUserId=? ");
            sql.append(" WHERE ");
            sql.append(" SERIAL=?");
            ps = conn.prepareStatement(sql.toString());
            int i = 0;
            ps.setInt(++i, dto.getStatus());
            if (dto.getLicensePlate() == null || !dto.getLicensePlate().equals(dto.getNewLicensePlate())) {
                ps.setString(++i, dto.getLicensePlate());
                ps.setString(++i, dto.getNewLicensePlate());
            }
            ps.setInt(++i, dto.getUpdateUserId());
            ps.setString(++i, dto.getSerial());
            ps.executeUpdate();
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());

        } finally {
            super.close(rs, ps);
        }

    }
    
    public static void main(String[] a) {
    	String date = "20180605";
        StringBuffer sql2 = new StringBuffer();
        sql2.append(" select A.memberId attnId,");
        sql2.append(" sum(A.transferPrice) dailyTransfer, "); // 今日充值
        sql2.append("0 dailyCount, ");//今日业务量
        sql2.append("0 dailyPayment, ");//应支付
        sql2.append("0 dailyPaymented, "); //实际支付
        sql2.append("B.attnName attnName,");// 姓名
        sql2.append("B.shortName shortName, ");// 所属商户
        sql2.append("if(B.virtualMargin is null,0,B.virtualMargin) dailyRemain, ");//今日余额
        sql2.append("'' dailyWarning ");//差异预警
        sql2.append(" from " + TmsTableNames.TMS_INTEGRAL_REGISTER +" A ");
        sql2.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " B ON(A.memberId = B.attnId) ");
        sql2.append(" where DATE_FORMAT(A.insertTime,'%Y%m%d')='"+date+"' and A.chargeType=10 and A.plusMinus=1 group by A.memberId " );
        System.out.println(sql2.toString());
        
         StringBuffer sql1 = new StringBuffer();
         sql1.append("select ");
         sql1.append("AAA.attnId attnId, ");//会员编号
         sql1.append("0 dailyTransfer,");
         sql1.append("AAA.dailyCount dailyCount, ");//今日业务量
         sql1.append("if(AAA.dailyPayment is null,0,AAA.dailyPayment) dailyPayment, ");//应支付
         sql1.append("if(BBB.dailyPaymented  is null,0,BBB.dailyPaymented) dailyPaymented, "); //实际支付
         sql1.append("AAA.attnName attnName,");// 姓名
         sql1.append("AAA.shortName shortName, ");// 所属商户
         sql1.append("if(AAA.virtualMargin is null,0,AAA.virtualMargin) dailyRemain, ");//今日余额
         sql1.append("if(AAA.dailyPayment=BBB.dailyPaymented,'正常','应支付与实际支付不符') dailyWarning ");//差异预警
         sql1.append(" FROM ");
         sql1.append(" (select ");
         sql1.append("   AA.attnId attnId, ");
         sql1.append("   count(*) dailyCount, ");
         sql1.append("   sum(AA.dailyPayment) dailyPayment, ");
         sql1.append("   BB.attnName attnName,");
         sql1.append("   BB.shortName shortName, ");
         sql1.append("   BB.virtualMargin  virtualMargin ");
         sql1.append(" FROM ");
         sql1.append("   (select A.attnId attnId, B.confValue dailyPayment from " );
         sql1.append(      TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A, ");
         sql1.append(      TmsTableNames.TMS_CONFIGURE + " B  ");
         sql1.append("    where concat('transferPrice',A.transferType)=B.confKey and A.attnId is not null and  DATE_FORMAT(A.payTime,'%Y%m%d') = "+"'"+date+"' ) AA ");
         sql1.append("             LEFT JOIN " + TmsTableNames.TMS_ATTN + " BB ON(AA.attnId = BB.attnId)");
         sql1.append("             GROUP BY AA.attnId ORDER BY dailyCount DESC ) AAA  ");
         sql1.append("                   LEFT JOIN ");
         sql1.append(" (select priceUserId attnId, sum(price) dailyPaymented from ");
         sql1.append(TmsTableNames.TMS_TRANSFER_FINANCE_DETAIL );
         sql1.append(" where priceType=9 and priceWay=1 and DATE_FORMAT(pricedate,'%Y%m%d') = "+"'"+date+"'" );
         sql1.append(" group by priceUserId ) BBB ON(AAA.attnId = BBB.attnId)  order by AAA.dailyCount desc  ");
        
        System.out.println(sql1.toString());
    }
    
    @Override
    public List<TransferAcceptedInfo> findDailyAcceptInfo(String date) throws TmsDaoException {
        PreparedStatement ps1 = null;
        ResultSet rs1 = null;
        StringBuffer sql1 = new StringBuffer();
        sql1.append("select ");
        sql1.append("AAA.attnId attnId, ");//会员编号
        sql1.append("0 dailyTransfer,");
        sql1.append("AAA.dailyCount dailyCount, ");//今日业务量
        sql1.append("if(AAA.dailyPayment is null,0,AAA.dailyPayment) dailyPayment, ");//应支付
        sql1.append("if(BBB.dailyPaymented  is null,0,BBB.dailyPaymented) dailyPaymented, "); //实际支付
        sql1.append("AAA.attnName attnName,");// 姓名
        sql1.append("AAA.shortName shortName, ");// 所属商户
        sql1.append("if(AAA.virtualMargin is null,0,AAA.virtualMargin) dailyRemain, ");//今日余额
        sql1.append("if(AAA.dailyPayment=BBB.dailyPaymented,'正常','应支付与实际支付不符') dailyWarning ");//差异预警
        sql1.append(" FROM ");
        sql1.append(" (select ");
        sql1.append("   AA.attnId attnId, ");
        sql1.append("   count(*) dailyCount, ");
        sql1.append("   sum(AA.dailyPayment) dailyPayment, ");
        sql1.append("   BB.attnName attnName,");
        sql1.append("   BB.shortName shortName, ");
        sql1.append("   BB.virtualMargin  virtualMargin ");
        sql1.append(" FROM ");
        sql1.append("   (select A.attnId attnId, B.confValue dailyPayment from " );
        sql1.append(      TmsTableNames.TMS_TRANSFER_ACCEPTED_INFO + " A, ");
        sql1.append(      TmsTableNames.TMS_CONFIGURE + " B  ");
        sql1.append("    where concat('transferPrice',A.transferType)=B.confKey and A.attnId is not null and  DATE_FORMAT(A.payTime,'%Y%m%d') = "+"'"+date+"' ) AA ");
        sql1.append("             LEFT JOIN " + TmsTableNames.TMS_ATTN + " BB ON(AA.attnId = BB.attnId)");
        sql1.append("             GROUP BY AA.attnId ORDER BY dailyCount DESC ) AAA  ");
        sql1.append("                   LEFT JOIN ");
        sql1.append(" (select priceUserId attnId, sum(price) dailyPaymented from ");
        sql1.append(TmsTableNames.TMS_TRANSFER_FINANCE_DETAIL );
        sql1.append(" where priceType=9 and priceWay=1 and DATE_FORMAT(pricedate,'%Y%m%d') = "+"'"+date+"'" );
        sql1.append(" group by priceUserId ) BBB ON(AAA.attnId = BBB.attnId)  order by AAA.dailyCount desc  ");
        List<TransferAcceptedInfo> list = new ArrayList<TransferAcceptedInfo>();
        try {
            ps1 = conn.prepareStatement(sql1.toString());
            rs1 = ps1.executeQuery();
            while (rs1.next()) {
            	TransferAcceptedInfo dto = new TransferAcceptedInfo();
            	dto.setAttnId(rs1.getString("attnId"));
            	dto.setDailyTransfer(rs1.getString("dailyTransfer")==null?"0":rs1.getString("dailyTransfer"));
            	dto.setDailyCount(rs1.getString("dailyCount"));
            	dto.setDailyPayment(rs1.getString("dailyPayment")==null?"0":rs1.getString("dailyPayment"));
            	dto.setDailyPaymented(rs1.getString("dailyPaymented"));
            	dto.setAttnName(rs1.getString("attnName"));
            	dto.setShortName(rs1.getString("shortName"));
            	dto.setDailyRemain(rs1.getString("dailyRemain"));
            	dto.setDailyWarning(rs1.getString("dailyWarning"));
            	list.add(dto);
            }
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());
        } finally {
            super.close(rs1, ps1);
        }

        //
        PreparedStatement ps2 = null;
        ResultSet rs2 = null;
        StringBuffer sql2 = new StringBuffer();
        sql2.append(" select A.memberId attnId,");
        sql2.append(" sum(A.transferPrice) dailyTransfer, "); // 今日充值
        sql2.append("0 dailyCount, ");//今日业务量
        sql2.append("0 dailyPayment, ");//应支付
        sql2.append("0 dailyPaymented, "); //实际支付
        sql2.append("B.attnName attnName,");// 姓名
        sql2.append("B.shortName shortName, ");// 所属商户
        sql2.append("if(B.virtualMargin is null,0,B.virtualMargin) dailyRemain, ");//今日余额
        sql2.append("'' dailyWarning ");//差异预警
        sql2.append(" from " + TmsTableNames.TMS_INTEGRAL_REGISTER +" A ");
        sql2.append(" LEFT JOIN " + TmsTableNames.TMS_ATTN + " B ON(A.memberId = B.attnId) ");
        sql2.append(" where DATE_FORMAT(A.insertTime,'%Y%m%d')='"+date+"' and A.chargeType=10 and A.plusMinus=1 group by A.memberId " );
        List<TransferAcceptedInfo> list2 = new ArrayList<TransferAcceptedInfo>();
        try {
            ps2 = conn.prepareStatement(sql2.toString());
            rs2 = ps2.executeQuery();
            while (rs2.next()) {
            	TransferAcceptedInfo dto = new TransferAcceptedInfo();
            	dto.setAttnId(rs2.getString("attnId"));
            	dto.setDailyTransfer(rs2.getString("dailyTransfer"));
            	dto.setDailyCount(rs2.getString("dailyCount"));
            	dto.setDailyPayment(rs2.getString("dailyPayment"));
            	dto.setDailyPaymented(rs2.getString("dailyPaymented"));
            	dto.setAttnName(rs2.getString("attnName"));
            	dto.setShortName(rs2.getString("shortName"));
            	dto.setDailyRemain(rs2.getString("dailyRemain"));
            	dto.setDailyWarning(rs2.getString("dailyWarning"));
            	list2.add(dto);
            }
        } catch (SQLException e) {
            throw new TmsDaoException(e.toString());
        } finally {
            super.close(rs2, ps2);
        }
        
        //merge
        Map map2 = new HashMap();
        for (TransferAcceptedInfo info : list2) map2.put(info.getAttnId(), info);
        for (TransferAcceptedInfo info : list) {
        	String attnId = info.getAttnId();
        	if(attnId == null || attnId.length() == 0) continue;
        	TransferAcceptedInfo info2 = (TransferAcceptedInfo) map2.remove(attnId);
        	if(info2 != null)  info.setDailyTransfer(info2.getDailyTransfer());
		}
        for (Object object : map2.values()) list.add((TransferAcceptedInfo) object);
        return list;
    }
    

}